diff options
Diffstat (limited to 'vim-latex')
142 files changed, 30000 insertions, 0 deletions
diff --git a/vim-latex/.gitignore b/vim-latex/.gitignore new file mode 100644 index 0000000..752c2c6 --- /dev/null +++ b/vim-latex/.gitignore @@ -0,0 +1,40 @@ +## To see if new rules exclude any existing files, run +## +## git ls-files -i --exclude-standard +## +## after modifying this file. + +## Generated by the build process + +## Editor backup and swap files +*~ +.\#* +\#**\# +.*.sw[op] +.sw[op] + +## Generated by Mac filesystem +.DS_Store + +## For rejects +*.orig +*.rej +*.ancestor +*.current +*.patched + +## Generated by StGit +patches-* +.stgit-*.txt + +## Documentation building +doc/db2vim/domutils.pyc +doc/db2vim/textutils.pyc +doc/latex-suite/ +doc/latex-suite.html +doc/latex-suite-quickstart/ +doc/latex-suite-quickstart.html + +## Pathogen (to make it easier to use vim-latex-git) +doc/tags +*.pyc diff --git a/vim-latex/Makefile b/vim-latex/Makefile new file mode 100644 index 0000000..2357024 --- /dev/null +++ b/vim-latex/Makefile @@ -0,0 +1,29 @@ +PREFIX=/usr/local +VIMDIR=$(PREFIX)/share/vim +BINDIR=$(PREFIX)/bin + +VERSION=1.8.23 +DATE=$(shell date +%Y%m%d) +COMMIT_COUNT=$(shell git log --oneline | wc -l) +ABBREV_HASH=$(shell git log --oneline | head -n 1 | cut -d\ -f 1) + +SNAPSHOTNAME=vim-latex-$(VERSION)-$(DATE).$(COMMIT_COUNT)-git$(ABBREV_HASH) + +snapshot: + git archive --prefix '$(SNAPSHOTNAME)/' HEAD | gzip > '$(SNAPSHOTNAME).tar.gz' + +install: + install -d '$(DESTDIR)$(VIMDIR)/doc' + install -m 0644 doc/*.txt '$(DESTDIR)$(VIMDIR)/doc' + + install -d '$(DESTDIR)$(VIMDIR)' + cp -R compiler ftplugin indent plugin '$(DESTDIR)$(VIMDIR)' + chmod 0755 '$(DESTDIR)$(VIMDIR)/ftplugin/latex-suite/outline.py' + + install -d '$(DESTDIR)$(BINDIR)' + install latextags ltags '$(DESTDIR)$(BINDIR)' + +upload: snapshot + scp '$(SNAPSHOTNAME).tar.gz' frs.sourceforge.net:/home/frs/project/v/vi/vim-latex/snapshots + +.PHONY: install upload diff --git a/vim-latex/Makefile.in b/vim-latex/Makefile.in new file mode 100644 index 0000000..d965cb0 --- /dev/null +++ b/vim-latex/Makefile.in @@ -0,0 +1,133 @@ +CVSUSER = srinathava +SSHCMD = ssh1 +DIR1 = $(PWD) + +.PHONY: latexs clean release updoc uphtdocs ltt changelog install stallin sync + +# The main target. This creates a latex suite archive (zip and tar.gz +# format) ensuring that all the files in the archive are in unix format so +# unix people can use it too... +latexs: + # plugins: + zip -q latexSuite.zip plugin/imaps.vim + zip -q latexSuite.zip plugin/SyntaxFolds.vim + zip -q latexSuite.zip plugin/libList.vim + zip -q latexSuite.zip plugin/remoteOpen.vim + zip -q latexSuite.zip plugin/filebrowser.vim + # ftplugins + zip -q latexSuite.zip ftplugin/tex_latexSuite.vim + zip -q latexSuite.zip ftplugin/bib_latexSuite.vim + zip -q latexSuite.zip ftplugin/tex/*.vim + # files in the latex-suite directory + zip -q -R latexSuite.zip `find ftplugin/latex-suite -name '*'` + # documentation + zip -q latexSuite.zip doc/latex*.txt + zip -q latexSuite.zip doc/imaps*.txt + # indentation + zip -q latexSuite.zip indent/tex.vim + # compiler + zip -q latexSuite.zip compiler/tex.vim + # external tools + zip -q latexSuite.zip ltags + + # Now to make a tar.gz file from the .zip file. + rm -rf $(TMP)/latexSuite0793 + mkdir -p $(TMP)/latexSuite0793 + cp latexSuite.zip $(TMP)/latexSuite0793/ + ( \ + cd $(TMP)/latexSuite0793/ ; \ + unzip -q -o latexSuite.zip ; \ + \rm latexSuite.zip ; \ + tar czf latexSuite.tar.gz * ; \ + \mv latexSuite.tar.gz $(DIR1)/ ; \ + ) + mv latexSuite.zip latexSuite`date +%Y%m%d`.zip ; \ + mv latexSuite.tar.gz latexSuite`date +%Y%m%d`.tar.gz ; \ + +# target for removing archive files. +clean: + rm -f latexSuite200* + +# make a local install directory. +ltt: + rm -rf /tmp/ltt/vimfiles/ftplugin + cp -f latexSuite.zip /tmp/ltt/vimfiles/ + cd /tmp/ltt/vimfiles; unzip latexSuite.zip + +# This target is related to a script I have on my sf.net account. That +# script looks like: +# +# #!/bin/bash +# cd ~/testing/vimfiles; \ +# cvs -q update; \ +# make clean; \ +# make; \ +# cp latexsuite.* ~/htdocs/download/ +# +# Doing a release via sf.net has a couple of advantages: +# - I do not have to bother with CRLF pain anymore because the copy on +# sf.net will always have unix style EOLs. +# - The process is much faster because I only need to communicate a command +# from my computer to sf.net. The rest is done locally on the sf.net +# server. +release: + $(SSHCMD) $(CVSUSER)@vim-latex.sf.net /home/groups/v/vi/vim-latex/bin/upload + +updoc: + $(SSHCMD) $(CVSUSER)@vim-latex.sf.net /home/groups/v/vi/vim-latex/bin/updoc + +# This is another target akin to the release: target. This target updates +# the htdocs directory of the latex-suite project to the latest CVS +# version. +# This is again related to the uphtdocs script on my sf.net account which +# looks like: +# #!/bin/sh +# +# # update the htdocs directory +# cd /home/groups/v/vi/vim-latex/htdocs; cvs -q update +# # update the packages directory +# cd /home/groups/v/vi/vim-latex/htdocs/packages; cvs -q update +uphtdocs: + $(SSHCMD) $(CVSUSER)@vim-latex.sf.net /home/groups/v/vi/vim-latex/bin/uphtdocs + +# Automatically generate the Changelog file using the cvs2cl utility +# +# Arguments: +# -S add a seperating line between filename and log +# --no-wrap Do not attempt to format the Changelog comments +# -f file to write the Changelog to. +changelog: + cvs2cl -S --no-wrap -f ftplugin/latex-suite/ChangeLog + +# rsync is like cp (copy) on steroids. Here are some useful options: +# -C auto ignore like CVS +# -r recurse into directories +# -t preserve times +# -u update (do not overwrite newer files) +# -W whole files, no incremental checks (default for local usage) +# --existing only update files that already exist +# --exclude exclude files matching the pattern +# -n dry run (for testing) + +# Usage: after "cvs update", do +# make install [VIMFILES=path/to/vimfiles] +# Before "cvs commit", do +# make stallin [VIMFILES=path/to/vimfiles] +# If you have made changes in both directories, and want to keep the most +# recent versions, do +# make sync [VIMFILES=path/to/vimfiles] +# Note: defining VIMFILES when you invoke make overrides the value below. +# Warning: install and stallin do not check modification times! + +VIMFILES=${HOME}/.vim +EXCLUDE="--exclude='*~' --exclude='*.swp' --exclude='makefile'" + +install: + rsync -CrtW ${EXCLUDE} . ${VIMFILES} + +# stallin = reverse install +# If you can think of a better name for this target, be my guest! +stallin: + rsync -CrtW --existing ${VIMFILES}/ . + +sync: install stallin diff --git a/vim-latex/compiler/tex.vim b/vim-latex/compiler/tex.vim new file mode 100644 index 0000000..d9543ad --- /dev/null +++ b/vim-latex/compiler/tex.vim @@ -0,0 +1,298 @@ +" File: tex.vim +" Type: compiler plugin for LaTeX +" Original Author: Artem Chuprina <ran@ran.pp.ru> +" Customization: Srinath Avadhanula <srinath@fastmail.fm> +" Description: {{{ +" This file sets the 'makeprg' and 'errorformat' options for the LaTeX +" compiler. It is customizable to optionally ignore certain warnings and +" provides the ability to set a dynamic 'ignore-warning' level. +" +" By default it is set up in a 'non-verbose', 'ignore-common-warnings' mode, +" which means that irrelevant lines from the compilers output will be +" ignored and also some very common warnings are ignored. +" +" Depending on the 'ignore-level', the following kinds of messages are +" ignored. An ignore level of 3 for instance means that messages 1-3 will be +" ignored. By default, the ignore level is set to 4. +" +" 1. LaTeX Warning: Specifier 'h' changed to 't'. +" This errors occurs when TeX is not able to correctly place a floating +" object at a specified location, because of which it defaulted to the +" top of the page. +" 2. LaTeX Warning: Underfull box ... +" 3. LaTeX Warning: Overfull box ... +" both these warnings (very common) are due to \hbox settings not being +" satisfied nicely. +" 4. LaTeX Warning: You have requested ..., +" This warning occurs in slitex when using the xypic package. +" 5. Missing number error: +" Usually, when the name of an included eps file is spelled incorrectly, +" then the \bb-error message is accompanied by a bunch of "missing +" number, treated as zero" error messages. This level ignores these +" warnings. +" NOTE: number 5 is actually a latex error, not a warning! +" +" Use +" TCLevel <level> +" where level is a number to set the ignore level dynamically. +" +" When TCLevel is called with the unquoted string strict +" TClevel strict +" then the 'efm' switches to a 'verbose', 'no-lines-ignored' mode which is +" useful when you want to make final checks of your document and want to be +" careful not to let things slip by. +" +" TIP: MikTeX has a bug where it sometimes erroneously splits a line number +" into multiple lines. i.e, if the warning is on line 1234. the compiler +" output is: +" LaTeX Warning: ... on input line 123 +" 4. +" In this case, vim will wrongly interpret the line-number as 123 instead +" of 1234. If you have cygwin, a simple remedy around this is to first +" copy the file vimlatex (provided) into your $PATH, make sure its +" executable and then set the variable g:tex_flavor to vimlatex in your +" ~/.vimrc (i.e putting let "g:tex_flavor = 'vimlatex'" in your .vimrc). +" This problem occurs rarely enough that its not a botheration for most +" people. +" +" TODO: +" 1. menu items for dynamically selecting a ignore warning level. +" }}} + +" avoid reinclusion for the same buffer. keep it buffer local so it can be +" externally reset in case of emergency re-sourcing. +if exists('b:doneTexCompiler') && !exists('b:forceRedoTexCompiler') + finish +endif +let b:doneTexCompiler = 1 + +" ============================================================================== +" Customization of 'efm': {{{ +" This section contains the customization variables which the user can set. +" g:Tex_IgnoredWarnings: This variable contains a ¡ seperated list of +" patterns which will be ignored in the TeX compiler's output. Use this +" carefully, otherwise you might end up losing valuable information. +if !exists('g:Tex_IgnoredWarnings') + let g:Tex_IgnoredWarnings = + \'Underfull'."\n". + \'Overfull'."\n". + \'specifier changed to'."\n". + \'You have requested'."\n". + \'Missing number, treated as zero.'."\n". + \'There were undefined references'."\n". + \'Citation %.%# undefined' +endif +" This is the number of warnings in the g:Tex_IgnoredWarnings string which +" will be ignored. +if !exists('g:Tex_IgnoreLevel') + let g:Tex_IgnoreLevel = 7 +endif +" There will be lots of stuff in a typical compiler output which will +" completely fall through the 'efm' parsing. This options sets whether or not +" you will be shown those lines. +if !exists('g:Tex_IgnoreUnmatched') + let g:Tex_IgnoreUnmatched = 1 +endif +" With all this customization, there is a slight risk that you might be +" ignoring valid warnings or errors. Therefore before getting the final copy +" of your work, you might want to reset the 'efm' with this variable set to 1. +" With that value, all the lines from the compiler are shown irrespective of +" whether they match the error or warning patterns. +" NOTE: An easier way of resetting the 'efm' to show everything is to do +" TCLevel strict +if !exists('g:Tex_ShowallLines') + let g:Tex_ShowallLines = 0 +endif + +" }}} +" ============================================================================== +" Customization of 'makeprg': {{{ + +" There are several alternate ways in which 'makeprg' is set up. +" +" Case 1 +" ------ +" The first is when this file is a part of latex-suite. In this case, a +" variable called g:Tex_DefaultTargetFormat exists, which gives the default +" format .tex files should be compiled into. In this case, we use the TTarget +" command provided by latex-suite. +" +" Case 2 +" ------ +" The user is using this file without latex-suite AND he wants to directly +" specify the complete 'makeprg'. Then he should set the g:Tex_CompileRule_dvi +" variable. This is a string which should be directly be able to be cast into +" &makeprg. An example of one such string is: +" +" g:Tex_CompileRule_dvi = 'pdflatex \\nonstopmode \\input\{$*\}' +" +" NOTE: You will need to escape back-slashes, {'s etc yourself if you are +" using this file independently of latex-suite. +" TODO: Should we also have a check for backslash escaping here based on +" platform? +" +" Case 3 +" ------ +" The use is using this file without latex-suite and he doesnt want any +" customization. In this case, this file makes some intelligent guesses based +" on the platform. If he doesn't want to specify the complete 'makeprg' but +" only the name of the compiler program (for example 'pdflatex' or 'latex'), +" then he sets b:tex_flavor or g:tex_flavor. + +if exists('g:Tex_DefaultTargetFormat') + exec 'TTarget '.g:Tex_DefaultTargetFormat +elseif exists('g:Tex_CompileRule_dvi') + let &l:makeprg = g:Tex_CompileRule_dvi +else + " If buffer-local variable 'tex_flavor' exists, it defines TeX flavor, + " otherwize the same for global variable with same name, else it will be LaTeX + if exists("b:tex_flavor") + let current_compiler = b:tex_flavor + elseif exists("g:tex_flavor") + let current_compiler = g:tex_flavor + else + let current_compiler = "latex" + end + if has('win32') + let escChars = '' + else + let escChars = '{}\' + endif + " Furthermore, if 'win32' is detected, then we want to set the arguments up so + " that miktex can handle it. + if has('win32') + let options = '--src-specials' + else + let options = '' + endif + let &l:makeprg = current_compiler . ' ' . options . + \ escape(' \nonstopmode \input{$*}', escChars) +endif + +" }}} +" ============================================================================== +" Functions for setting up a customized 'efm' {{{ + +" IgnoreWarnings: parses g:Tex_IgnoredWarnings for message customization {{{ +" Description: +function! <SID>IgnoreWarnings() + let i = 1 + while s:Strntok(g:Tex_IgnoredWarnings, "\n", i) != '' && + \ i <= g:Tex_IgnoreLevel + let warningPat = s:Strntok(g:Tex_IgnoredWarnings, "\n", i) + let warningPat = escape(substitute(warningPat, '[\,]', '%\\\\&', 'g'), ' ') + exe 'setlocal efm+=%-G%.%#'.warningPat.'%.%#' + let i = i + 1 + endwhile +endfunction + +" }}} +" SetLatexEfm: sets the 'efm' for the latex compiler {{{ +" Description: +function! <SID>SetLatexEfm() + + let pm = ( g:Tex_ShowallLines == 1 ? '+' : '-' ) + + setlocal efm= + " remove default error formats that cause issues with revtex, where they + " match version messages + " Reference: http://bugs.debian.org/582100 + setlocal efm-=%f:%l:%m + setlocal efm-=%f:%l:%c:%m + + if !g:Tex_ShowallLines + call s:IgnoreWarnings() + endif + + setlocal efm+=%E!\ LaTeX\ %trror:\ %m + setlocal efm+=%E!\ %m + setlocal efm+=%E%f:%l:\ %m + + setlocal efm+=%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%# + setlocal efm+=%+W%.%#\ at\ lines\ %l--%*\\d + setlocal efm+=%+WLaTeX\ %.%#Warning:\ %m + + exec 'setlocal efm+=%'.pm.'Cl.%l\ %m' + exec 'setlocal efm+=%'.pm.'Cl.%l\ ' + exec 'setlocal efm+=%'.pm.'C\ \ %m' + exec 'setlocal efm+=%'.pm.'C%.%#-%.%#' + exec 'setlocal efm+=%'.pm.'C%.%#[]%.%#' + exec 'setlocal efm+=%'.pm.'C[]%.%#' + exec 'setlocal efm+=%'.pm.'C%.%#%[{}\\]%.%#' + exec 'setlocal efm+=%'.pm.'C<%.%#>%m' + exec 'setlocal efm+=%'.pm.'C\ \ %m' + exec 'setlocal efm+=%'.pm.'GSee\ the\ LaTeX%m' + exec 'setlocal efm+=%'.pm.'GType\ \ H\ <return>%m' + exec 'setlocal efm+=%'.pm.'G\ ...%.%#' + exec 'setlocal efm+=%'.pm.'G%.%#\ (C)\ %.%#' + exec 'setlocal efm+=%'.pm.'G(see\ the\ transcript%.%#)' + exec 'setlocal efm+=%'.pm.'G\\s%#' + exec 'setlocal efm+=%'.pm.'O(%*[^()])%r' + exec 'setlocal efm+=%'.pm.'P(%f%r' + exec 'setlocal efm+=%'.pm.'P\ %\\=(%f%r' + exec 'setlocal efm+=%'.pm.'P%*[^()](%f%r' + exec 'setlocal efm+=%'.pm.'P(%f%*[^()]' + exec 'setlocal efm+=%'.pm.'P[%\\d%[^()]%#(%f%r' + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-P%*[^()] + endif + exec 'setlocal efm+=%'.pm.'Q)%r' + exec 'setlocal efm+=%'.pm.'Q%*[^()])%r' + exec 'setlocal efm+=%'.pm.'Q[%\\d%*[^()])%r' + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-Q%*[^()] + endif + if g:Tex_IgnoreUnmatched && !g:Tex_ShowallLines + setlocal efm+=%-G%.%# + endif + +endfunction + +" }}} +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" SetTexCompilerLevel: sets the "level" for the latex compiler {{{ +function! <SID>SetTexCompilerLevel(...) + if a:0 > 0 + let level = a:1 + else + call Tex_ResetIncrementNumber(0) + echo substitute(g:Tex_IgnoredWarnings, + \ '^\|\n\zs\S', '\=Tex_IncrementNumber(1)." ".submatch(0)', 'g') + let level = input("\nChoose an ignore level: ") + if level == '' + return + endif + endif + if level == 'strict' + let g:Tex_ShowallLines = 1 + elseif level =~ '^\d\+$' + let g:Tex_ShowallLines = 0 + let g:Tex_IgnoreLevel = level + else + echoerr "SetTexCompilerLevel: Unkwown option [".level."]" + end + call s:SetLatexEfm() +endfunction + +com! -nargs=? TCLevel :call <SID>SetTexCompilerLevel(<f-args>) +" }}} + +" }}} +" ============================================================================== + +call s:SetLatexEfm() + +if !exists('*Tex_Debug') + function! Tex_Debug(...) + endfunction +endif + +call Tex_Debug("compiler/tex.vim: sourcing this file", "comp") + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/doc/Makefile b/vim-latex/doc/Makefile new file mode 100644 index 0000000..7e05e67 --- /dev/null +++ b/vim-latex/doc/Makefile @@ -0,0 +1,62 @@ +projects = latex-suite latex-suite-quickstart +htmlfiles = $(addsuffix .html, $(projects)) +txtfiles = $(addsuffix .txt, $(projects)) +cssfiles = $(addsuffix .css, $(projects)) +all = $(projects) $(htmlfiles) $(cssfiles) $(txtfiles) + + +xsltproc=xsltproc +db2vim=db2vim/db2vim + +# Use for debugging: +#xsltproc=strace -e trace=file xsltproc --nonet --load-trace +# export XML_DEBUG_CATALOG = 1 + +# Specify local catalog to not use system installed dtd/xsl files +# export XML_CATALOG_FILES=catalog.xml + +# User configuration of this Makefile goes into Makefile.local +# E.g. to use a catalog file installed by the user. +-include Makefile.local + +# Default Target is to create all documentation files +all: $(all) + +# create multi page html (chunk xhtml) +$(projects): %: %.xml latex-suite-chunk.xsl latex-suite-common.xsl + $(xsltproc) -o $@/ latex-suite-chunk.xsl $< + +# create single html files +$(htmlfiles): %.html: %.xml latex-suite.xsl latex-suite-common.xsl + $(xsltproc) -o $@ latex-suite.xsl $< + +# create vim flat files +latex-suite.txt: %.txt: %.xml + $(db2vim) --prefix=ls_ $< > $@ + +latex-suite-quickstart.txt: %.txt: %.xml + $(db2vim) --prefix=lq_ $< > $@ + +# validate xml +validate: + for file in *.xml; do \ + xmllint --valid --noout $$file; \ + done + +clean: + rm -f $(htmlfiles) + rm -rf $(projects) + +# $(txtfiles) are currently in revision control, therefore they are not +# removed in the clean target +mr-proper: clean + rm -f $(txtfiles) + +upload: $(all) +# vim-latex-web is configured in ~/.ssh/config +#Host vim-latex-web +# Hostname web.sourceforge.net +# User SOURCEFORGE_USERNAME,vim-latex + rsync --perms --chmod g+w,o-w --delete -lrtvz $(all) vim-latex-web:/home/groups/v/vi/vim-latex/htdocs/documentation/ + +# vim:nowrap diff --git a/vim-latex/doc/Makefile.in b/vim-latex/doc/Makefile.in new file mode 100644 index 0000000..6d5e614 --- /dev/null +++ b/vim-latex/doc/Makefile.in @@ -0,0 +1,29 @@ +# Manual files +ls-flat: + java com.icl.saxon.StyleSheet latex-suite.xml latex-suite.xsl > latex-suite.html + +ls-chunk: + ( \ + cd latex-suite && \ + java com.icl.saxon.StyleSheet ../latex-suite.xml ../latex-suite-chunk.xsl \ + ) + +ls-txt: + db2vim --prefix=ls_ latex-suite.xml > latex-suite.txt + +# Quickstart files +lsq-flat: + java com.icl.saxon.StyleSheet latex-suite-quickstart.xml latex-suite.xsl > latex-suite-quickstart.html + +lsq-chunk: + ( \ + cd latex-suite-quickstart && \ + java com.icl.saxon.StyleSheet ../latex-suite-quickstart.xml ../latex-suite-chunk.xsl \ + ) + +lsq-txt: + db2vim --prefix=lq_ latex-suite-quickstart.xml > latex-suite-quickstart.txt + +cvsci: + cvs ci latex-suite.xml latex-suite.txt +# vim:nowrap diff --git a/vim-latex/doc/README b/vim-latex/doc/README new file mode 100644 index 0000000..7ba1d7c --- /dev/null +++ b/vim-latex/doc/README @@ -0,0 +1,110 @@ +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +This file is outdated, please look at README.new for updated information +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +==================================== +Generating Latex-Suite documentation +==================================== + +In order to generate the html files and vim-help files from the XML source, +you will need to do follow the following steps. The steps are complex only +for a windows machine. On most (modern) linux machines, the various +utilities are already installed and all you need to do is some +soft-linking. + +1. Download the Docbook XSL stylesheets from + + http://sourceforge.net/project/showfiles.php?group_id=21935 + + I downloaded docbook-xsl-1.61.2.tar.gz. Unpack this archive under the + present directory. You should see something like:: + + ./docbook-xsl-1.XX.X/ + + Rename this to:: + + ./docbook-xsl + + Alternatively, if you are on a modern unix system, the docbook-xsl + stylesheets should already be installed on your system. Soft-linking + will thus work more simply. On a typical Debian box, just do:: + + ln -s /usr/share/sgml/docbook/stylesheet/xsl/nwalsh docbook-xsl + + The docbook-xsl stylesheets can be installed via the docbook-xsl + package on Debian. (Just use apt-get). + +2. Download the Docbook DTD from + + http://www.oasis-open.org/docbook/xml/4.2/docbook-xml-4.2.zip + + Extract this into a subdirectory ``docbook-xml/`` under the present + directory. You should see something like:: + + ./docbook-xml/ + + with a file ``docbookx.dtd`` located there. + + **CAUTION**: + The archive above does not create a top level directory but + unzips directly into the present directory. Therefore, make sure to + run the unzip by first creating ``./docbook-xml/``, copying the zip + file there and then unzipping. + + Alternatively, if you are on a modern unix system, the docbook-xml DTD + will already be installed. Softlinking will thus work. On a typical + Debian box, you could do:: + + ln -s /usr/share/sgml/docbook/dtd/xml/4.2 docbook-xml + + On debian, you need the docbook-xml package on Debian. (Just use + apt-get). + +3. Download saxon.jar from + + http://vim-latex.sourceforge.net/documentation/saxon.jar + + This is the bare .jar file without any of the other things which saxon + comes with. Add the ``saxon.jar`` file to your ``$CLASSPATH`` setting. + + **NOTE:** + The ``$CLASSPATH`` setting should point to the ``saxon.jar`` file, + not the directory where it resides. + + Again, on a unix system, you might not need to download this. For debian + systems, the saxon.jar file resides in:: + + /usr/share/java/saxon.jar + + You can point your ``$CLASSPATH`` to that file. + +4. Download db2vim (created by me :)) via anonymous cvs:: + + mkdir -p ~/bin/db2vim + cvs -d :pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex \ + co -d ~/bin/db2vim db2vim + + Add the ``~/bin/db2vim/`` directory thus created to your ``$PATH`` + setting. + +5. Create a new directory ``latex-suite/`` under the present directory for + the chunked html files to reside in. You should see something like:: + + ./latex-suite/ + +6. Copy ``Makefile.in`` to ``Makefile`` or ``makefile`` and perform any + necessary customizations. For example, if you are using Activestate + python under windows, you will need to change the ls-txt: target as:: + + python e:/srinath/testing/db2vim/db2vim latex-suite.xml > latex-suite.txt + + +Thats it! You are ready. Now you can do:: + + make ls-chunk + make ls-flat + make ls-txt + +to create the 3 formats. + +Author: Srinath Avadhanula <srinath@fastmail.fm> diff --git a/vim-latex/doc/README.new b/vim-latex/doc/README.new new file mode 100644 index 0000000..678091c --- /dev/null +++ b/vim-latex/doc/README.new @@ -0,0 +1,17 @@ +==================================== +Generating Latex-Suite documentation +==================================== + +You need: +- xsltproc +- Docbook XSL stylesheets (*) +- Docbook DTD (*) + +(*) These files will be downloaded every time you create the documentation, +unless you install or download them. + +On Fedora, you can run as root: + +yum install libxslt docbook-style-xsl docbook-dtds + +to install the required packages. diff --git a/vim-latex/doc/catalog.xml b/vim-latex/doc/catalog.xml new file mode 100644 index 0000000..cfc984c --- /dev/null +++ b/vim-latex/doc/catalog.xml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!DOCTYPE catalog + PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN" + "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"> +<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> + <rewriteSystem + systemIdStartString="http://docbook.sourceforge.net/release/xsl/current" + rewritePrefix="docbook-xsl/"/> + <rewriteURI + uriStartString="http://docbook.sourceforge.net/release/xsl/current/" + rewritePrefix="docbook-xsl/" /> +</catalog> diff --git a/vim-latex/doc/db2vim/db2vim b/vim-latex/doc/db2vim/db2vim new file mode 100755 index 0000000..d1e6902 --- /dev/null +++ b/vim-latex/doc/db2vim/db2vim @@ -0,0 +1,761 @@ +#!/usr/bin/python +r""" +db2vim [options] file.xml + +SHORT OPTIONS + +-d Prints some debugging information on stderr. + +-s If given, the db2vim operates in a 'stict' conversion mode, i.e, any + element which does not have a handler defined for them it be + completeley ignored including all its children. Otherwise, db2vim will + recurse into an unknown tag and process any of its children it + recognizes. Since db2vim always recognizes text nodes, not using this + option has the effect that all text will be printed out, even if + somewhat incorrectly. + +LONG OPTIONS + +--prefix=<prefix> + This is a string like "ls_" which will be prepended to the section + numbers. Default to 'ls_' if unsupplied. +""" + + +import xml.dom.minidom +import getopt +import string +import re +import sys + +# Okay. so I import *. Shoot me. +from textutils import * +from domutils import * + +# define a bunch of constants for formatting. +TEXT_WIDTH = 80 +BLOCK_QUOTE = 4 +COL_SPACE = 2 + +# a bunch of globals used in creating the Table of contents. +# +# TOC_HASH['section 1.1 label'] = 'ls_1_1' +# +# LEVEL_HASH['section 1.1 label'] = 1 +# (top level article has level 0) +# +# TITLE_HASH['section 1.1 label'] = 'Title of section 1.1' +# +# FILENAME = the name of the file being processed with the last extension +# changed to .txt +# +# TOC_PREFIX = 'ls_' (the prefix used to create the section labels). +TOC_HASH = {} +LEVEL_HASH = {} +TITLE_HASH = {} +FILENAME = '' +TOC_PREFIX = '' + +ANCHOR_HASH = {} +URL_HASH = {} + +# STDERR for printing debugging info. +DEBUG = 0 +STDERR = sys.stderr +STRICT = 0 +NUM_ANCHORS = {0:1} + +################################################################################ +# Miscellaneous utility functions +################################################################################ +# encodeTo52(num) {{{ +def encodeTo52(num): + ret = '' + + if num < 26: + return unichr(ord('a') + num) + elif num < 52: + return unichr(ord('A') + num - 26) + else: + return encodeTo52(int(num/52)) + encodeTo52(num % 52) +# }}} +# makeTocHash(rootElement) {{{ +def makeTocHash(rootElement, width, prefix='', level=0): + retText = "" + sectionsTable = [] + lastLabelUsed = 0 + + for section in rootElement.getChildrenByTagName('section'): + title = section.getChildrenByTagName('title')[0] + titleText = handleElement(title, width) + lastLabelUsed += 1 + thisLabel = TOC_PREFIX + prefix + str(lastLabelUsed) + + sectionid = section.getAttribute('id') + if not sectionid: + section.setAttribute('id', thisLabel) + sectionid = thisLabel + + NUM_ANCHORS[0] += 1 + ANCHOR_HASH[sectionid] = TOC_PREFIX + 'a_' + encodeTo52(NUM_ANCHORS[0] + 52) + + TOC_HASH[sectionid] = thisLabel + LEVEL_HASH[sectionid] = level + TITLE_HASH[sectionid] = titleText + + if section.getChildrenByTagName('section'): + childText = makeTocHash(section, width - 5, + prefix = prefix+str(lastLabelUsed) + '_', + level = level + 1) + +# }}} +# makeAnchorHash(rootElement) {{{ +def makeAnchorHash(rootElement): + anchors = rootElement.getElementsByTagName('anchor') + rootElement.getElementsByTagName('note') + numAnchors = 0 + for anchor in anchors: + if not anchor.getAttribute('id'): + continue + + NUM_ANCHORS[0] += 1 + if ANCHOR_HASH.has_key(anchor.getAttribute('id')) or TOC_HASH.has_key(anchor.getAttribute('id')): + print >> STDERR, "Warning: anchor [%s] multiply defined" % anchor.getAttribute('id') + + ANCHOR_HASH[anchor.getAttribute('id')] = TOC_PREFIX + 'a_' + encodeTo52(NUM_ANCHORS[0] + 52) + +# }}} +# makeURLHash(rootElement) {{{ +def makeURLHash(rootElement): + urls = rootElement.getElementsByTagName('ulink') + numURLs = 0 + for url in urls: + if not url.getAttribute('url') or URL_HASH.has_key(url.getAttribute('url')): + continue + numURLs += 1 + URL_HASH[url.getAttribute('url')] = TOC_PREFIX + 'u_' + str(numURLs) + +# }}} +# makeTOC(node, width, prefix='', level=0, maxleve=1): {{{ +def makeTOC(node, width, maxlevel=1): + retText = "" + sectionsTable = [] + lastLabelUsed = 0 + + for section in node.getChildrenByTagName('section'): + + sectionid = section.getAttribute('id') + thisLabel = TOC_HASH.get(sectionid, '') + titleText = TITLE_HASH.get(sectionid, '') + level = LEVEL_HASH.get(sectionid, 10) + + if level <= maxlevel: + retText += '|' + thisLabel + '| ' + titleText + '\n' + + if level < maxlevel and section.getChildrenByTagName('section'): + childText = makeTOC(section, width-5) + retText += VertCatString(" ", 4, childText) + '\n' + + retText = re.sub(r'\s+$', r'\n', retText) + + return retText +# }}} + +################################################################################ +# Generalized function for handling dom elements. +################################################################################ +# IsInlineTag(self): {{{ +def IsInlineTag(self): + if self.nodeType == self.TEXT_NODE: + return 1 + elif inlineTags.get(self.tagName, 0): + return 1 + else: + return 0 + + +# }}} +# getChildrenByTagName(self, name): {{{ +# Description: extension to the xml.dom.minidom.Element class. +# returns all direct descendants of this Element. +def getChildrenByTagName(self, name): + nodeList = [] + + child = self.firstChild + while not child is None: + if child.nodeType == child.ELEMENT_NODE and child.nodeName == name: + nodeList.append(child) + + child = child.nextSibling + + return nodeList + +xml.dom.minidom.Element.getChildrenByTagName = getChildrenByTagName + + +# }}} +# handleElement(rootElement, width=TEXT_WIDTH): {{{ +def handleElement(rootElement, width=TEXT_WIDTH): + """ + handleElement(rootElement, width=TEXT_WIDTH): + + Generalized function to handle an Element node in a DOM tree. + """ + + retText = "" + child = rootElement.firstChild + while not child is None: + + printerr('node type = %d' % child.nodeType) + if child.nodeType == child.ELEMENT_NODE: + printerr('processing [%s]' % child.tagName) + + isinline = IsInlineTag(child) + + # if the child is an Element and if a handler exists, then call it. + if not isinline \ + and child.nodeType == child.ELEMENT_NODE \ + and handlerMaps.has_key(child.tagName): + # offset the child text by the current indentation value + printerr('making recursive call to known child.') + retText += handlerMaps[child.tagName](child, width) + child = child.nextSibling + + elif not isinline \ + and child.nodeType == child.PROCESSING_INSTRUCTION_NODE \ + and child.target == 'vimhelp': + + if handlerMaps.has_key(child.data): + retText += handlerMaps[child.data](child, width) + + child = child.nextSibling + + # if its a text node or an inline element node, collect consecutive + # text nodes into a single paragraph and indent it. + elif isinline: + + text = "" + while not child is None and IsInlineTag(child): + if child.nodeType == child.TEXT_NODE: + text += child.data + elif child.nodeType == child.ELEMENT_NODE: + if handlerMaps.has_key(child.tagName): + text += handlerMaps[child.tagName](child, width) + else: + text += GetText(child.childNodes) + child = child.nextSibling + + retText += IndentParagraphs(text, width) + + # If we cannot understand _anything_ about the element, then just + # handle its children hoping we have something to gather from + # there. + elif not STRICT: + printerr('making recursive call for unkown child') + retText += handleElement(child, width) + child = child.nextSibling + + else: + child = child.nextSibling + + return retText + +# }}} + +################################################################################ +# Functions for handling various xml tags +################################################################################ +# handleArticleInfo(articleinfo, width): {{{ +def handleArticleInfo(articleinfo, width): + + makeTocHash(articleinfo.parentNode, width) + makeAnchorHash(articleinfo.parentNode) + makeURLHash(articleinfo.parentNode) + + title = articleinfo.getChildrenByTagName('title') + if title is None: + print("Article should have a title!") + sys.exit(1) + + name = GetText(title[0].childNodes) + authors = articleinfo.getChildrenByTagName('author') + + authorText = '' + for author in authors: + firstname = '' + surname = '' + if author.getElementsByTagName('firstname'): + firstname = GetTextFromElementNode(author, 'firstname')[0] + if author.getChildrenByTagName('surname'): + surname = GetTextFromElementNode(author, 'surname')[0] + if author.getElementsByTagName('email'): + email = GetTextFromElementNode(author, 'email')[0] + authorText = authorText + firstname + ' ' + surname + ' <' + email + '>\n' + + + abstractText = '' + abstract = articleinfo.getChildrenByTagName('abstract') + if abstract is not None: + abstractText = '\n\n' + CenterText('Abstract\n========', width) + abstractText += handleElement(abstract[0], width) + '\n' + + + retText = CenterText(name + '\n*' + FILENAME + '*\n' + authorText, width) + retText += abstractText + + toc = makeTOC(articleinfo.parentNode, width) + + foldwarn = r''' +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. +''' + + return retText + '\n' + RightJustify('*' + FILENAME + '-toc*', width) + '\n' + toc + foldwarn + +# }}} +# handleOption(option, width): {{{ +def handleOption(option, width): + retText = "" + names = GetTextFromElementNode(option, "name") + + for name in names: + retText += string.rjust("*"+name+"*", width) + "\n" + + nameTexts = "" + maxNameLen = -1 + for name in names: + maxNameLen = max(maxNameLen, len(name + " ")) + nameTexts += name + " \n" + + desc = option.getChildrenByTagName("desc")[0] + descText = handleElement(desc, width=width-maxNameLen) + + retText += VertCatString(nameTexts + " ", None, descText) + + return retText + "\n" + +# }}} +# handleOptionDefault(default, width): {{{ +def handleOptionDefault(default, width): + type = string.join(GetTextFromElementNode(default, "type"), "\n") + extra = string.join(GetTextFromElementNode(default, "extra"), "\n") + return type + "\t(" + extra + ")" + +# }}} +# handleTableRoot(root, width): {{{ +def handleTableRoot(root, width): + tgroup = root.getChildrenByTagName('tgroup')[0] + if tgroup is None: + return '' + + rows = [] + numHeadRows = 0 + if tgroup.getChildrenByTagName('thead'): + thead = tgroup.getChildrenByTagName('thead')[0] + rows = thead.getChildrenByTagName('row') + numHeadRows = len(rows) + + tbody = tgroup.getChildrenByTagName('tbody')[0] + rows += tbody.getChildrenByTagName('row') + + widths, text = calculateColumnWidthsDoublePass(rows, width) + + headText = text[0:numHeadRows] + bodyText = text[numHeadRows:] + + headTable = FormatTable(headText, ROW_SPACE = 1, COL_SPACE = + COL_SPACE, justify = 0, widths = widths) + if headTable: + headTable = re.sub(r'\n|$', '\g<0>~', headTable) + bodyTable = FormatTable(bodyText, ROW_SPACE = 1, COL_SPACE = + COL_SPACE, justify = 0, widths = widths) + + return headTable + '\n'+ re.sub(r'\n+$', '', bodyTable) + '\n\n' + +# calculateColumnWidths(rows, width): {{{ +def calculateColumnWidths(rows, alloc_widths): + widths = {} + text = [] + for row in rows: + cols = row.getChildrenByTagName("entry") + if len(alloc_widths) == 1: + alloc_widths *= len(cols) + + colwidths = [] + rowtext = [] + for col, width in zip(cols, alloc_widths): + coltext = handleElement(col, width) + + rowtext.append(coltext) + # This is the 'width' of the current cell including the + # whitespace padding. + colwidths.append(max(map(len, coltext.split("\n"))) \ + + COL_SPACE) + + text.append(rowtext) + + # update the widths of the columns by finding the maximum + # width of all cells in this column. + for i in range(len(colwidths)): + widths[i] = max(colwidths[i], widths.get(i, -1)) + + return widths, text + +# }}} +# calculateColumnWidthsDoublePass(rows, width): {{{ +def calculateColumnWidthsDoublePass(rows, width): + maxwidths, text = calculateColumnWidths(rows, [width]) + if reduce(lambda x, y: x+y, maxwidths.values()) <= width: + return maxwidths, text + + # now find out how many columns exceed the maximum permitted width. + # nlarge: number of columns which are too wide. + # remainingWidth: width which these large columns can share. + nlarge = 0 + remainingWidth = width + for colwidth in maxwidths.values(): + if colwidth > width/len(maxwidths): + nlarge += 1 + else: + remainingWidth += -colwidth + + # newmaxwidth: width which each of the large columns is allowed. + newmaxwidth = remainingWidth/max(nlarge, 1) + + newcolwidths = [] + for colwidth in maxwidths.values(): + newcolwidths += [min(colwidth, newmaxwidth)] + + # make another run and this time ask each cell to restrict itself to + # newmaxwidth as calculated above. + newmaxwidth, newtext = calculateColumnWidths(rows, newcolwidths) + + return newmaxwidth, newtext + +# }}} +# }}} +# handleCode(code, width): {{{ +def handleCode(code, width): + retText = GetText(code.childNodes) + return " &codebegin;\n" + VertCatString(" ", 4, retText) + "&codeend;" + + +# }}} +# handleList(list, width, marker=0): {{{ +def handleList(list, width, marker=0): + if list.tagName == 'simplelist': + child = 'member' + decoration = '' + elif list.tagName == 'orderedlist': + child = 'listitem' + else: + child = 'member' + decoration = '- ' + + retText = "" + items = list.getChildrenByTagName(child) + i = 1 + + for item in items: + if list.tagName == 'orderedlist': + decoration = str(i) + '. ' + i = i + 1 + itemText = handleElement(item, width - len(decoration)) + itemText = VertCatString(decoration, None, itemText) + + retText += '\n' + re.sub(r'\s+$', '', itemText) + "\n" + + return retText + +# }}} +# handleNote(note, width): {{{ +def handleNote(note, width): + title = None + if note.getChildrenByTagName('title'): + title = note.getChildrenByTagName('title')[0] + name = GetText(title.childNodes) + note.removeChild(title) + + noteid = '' + if note.getAttribute('id'): + noteTagText = '*' + note.getAttribute('id') + '* ' + noteTagText += '*' + ANCHOR_HASH[note.getAttribute('id')] + '*' + noteTagText = IndentParagraphs(noteTagText, width/2) + noteid = RightJustify(noteTagText, width) + '\n' + + noteText = handleElement(note, width-len("NOTE: ")) + if title is not None: + noteText = name + '\n' +('-' * len(name)) + '\n' + noteText + + noteText = noteid + VertCatString("NOTE: ", None, noteText) + + return noteText + "\n" + +# }}} +# handleParagraph(paragraph, width): {{{ +def handleParagraph(paragraph, width): + partext = handleElement(paragraph, width) + + partext = re.sub(r'\n+$', '', partext) + partext = re.sub(r'^\n+', '', partext) + + return partext + "\n\n" + +# }}} +# handleFormalParagraph(paragraph, width): {{{ +def handleFormalParagraph(formalparagraph, width): + title = None + if formalparagraph.getChildrenByTagName('title'): + title = formalparagraph.getChildrenByTagName('title')[0] + name = GetText(title.childNodes) + formalparagraph.removeChild(title) + + partext = handleElement(formalparagraph, width) + + partext = re.sub(r'\n+$', '', partext) + partext = re.sub(r'^\n+', '', partext) + if title is not None: + partext = name + '\n' + ('-' * len(name)) + '\n' + partext + + return partext + "\n\n" + +# }}} +# handleBlockQuote(block, width): {{{ +def handleBlockQuote(block, width): + text = handleElement(block, width - BLOCK_QUOTE) + text = VertCatString(" "*BLOCK_QUOTE, \ + BLOCK_QUOTE, text) + + return text + "\n" + +# }}} +# handleLink(link, width): {{{ +def handleLink(link, width): + linkend = link.getAttribute('linkend') + if not ANCHOR_HASH.has_key(linkend): + print >> STDERR, "Warning: Link ID [%s] not found in TOC" % linkend + text = handleElement(link, width) + anchorpt = ANCHOR_HASH.get(linkend) + if not anchorpt: + anchorpt = '' + + return text + ' [|' + anchorpt + '|]' + +# }}} +# handleAnchor(anchor, width): {{{ +def handleAnchor(anchor, width): + anchorText = '*'+anchor.getAttribute('id')+'* ' + anchorText += '*'+ANCHOR_HASH[anchor.getAttribute('id')]+'*' + return RightJustify(anchorText, width) \ + + "\n" + +# }}} +# handleSection(section, width): {{{ +def handleSection(section, width): + title = section.getChildrenByTagName('title')[0] + name = handleElement(title, width) + + sectionid = section.getAttribute('id') + tagsformatted = '' + if TOC_HASH.has_key(sectionid): + tagsformatted = '*%s* ' % TOC_HASH[sectionid] + + if ANCHOR_HASH.has_key(sectionid): + tagsformatted += '*%s* ' % ANCHOR_HASH[sectionid] + + if sectionid and TOC_HASH.has_key(sectionid) and sectionid != TOC_HASH[sectionid]: + tagsformatted += '*%s*' % sectionid + + # try to indent to a width of 20 + tagsformatted = RightJustify(IndentParagraphs(tagsformatted, 30), 0) + tagswidth = TextWidth(tagsformatted) + + # width(name) + nspaces + width(tags) = 80 + if len(tagsformatted) > 2: + header = VertCatString(name, 80-tagswidth, tagsformatted) + else: + header = name + + section.removeChild(title) + text = handleElement(section, width) + + thislevel = LEVEL_HASH.get(sectionid, -1) + if thislevel == 0: + delim = '=' + newlines = '\n\n' + elif thislevel == 1: + delim = '-' + newlines = '\n' + else: + delim = '' + newlines = '\n' + + thisTOC = '' + if thislevel <= 1: + thisTOC = makeTOC(section, width, maxlevel=1) + + return "\n" + (delim * TEXT_WIDTH) + \ + "\n" + header + newlines + thisTOC + newlines + re.sub(r'\n+$', '', text) + "\n" + +# }}} +# handleUlink(ulink, width) {{{ +def handleUlink(ulink, width): + url = ulink.getAttribute('url') + text = handleElement(ulink) + # URL_HASH is created at the very beginning + if url: + return text + ' |%s|' % URL_HASH[url] + else: + print >> STDERR, "Warning: url attribute empty for [%s]" % text + return text + +# }}} +# handleIndexTerm(indexterm, width) {{{ +def handleIndexTerm(indexterm, width) : + return '' +# }}} +# handleEmphasis(emphasis, width) {{{ +def handleEmphasis(emphasis, width): + return '_' + GetText(emphasis.childNodes) + '_' +# }}} + +################################################################################ +# A dictionary for mapping xml tags to functions. +################################################################################ +# {{{ +handlerMaps = { + 'articleinfo': handleArticleInfo, + 'table': handleTableRoot, + 'informaltable': handleTableRoot, + 'code': handleCode, + 'programlisting': handleCode, + 'list': handleList, + 'simplelist': handleList, + 'orderedlist': handleList, + 'para': handleParagraph, + 'formalpara': handleFormalParagraph, + 'note': handleNote, + 'link': handleLink, + 'anchor': handleAnchor, + 'section': handleSection, + 'blockquote': handleBlockQuote, + 'ulink': handleUlink, + 'emphasis': handleEmphasis, + 'indexterm': handleIndexTerm +} +inlineTags = {'tag':1, 'literal':1, 'link':1, + 'ulink':1, 'citetitle':1, 'indexterm':1, + 'emphasis':1, 'filename':1 } +# }}} + +# helper functions for usage() and printerr() {{{ +def usage(): + print __doc__ + +def printerr(statement): + if DEBUG: + print >> STDERR, statement + +# }}} +# replaceComment(matchobj) {{{ +def replaceComment(matchobj): + initspace = matchobj.group(1) + firstsent = matchobj.group(2) + code = matchobj.group(3) + + if len(initspace) > 0: + if initspace[0] == '<': + lastspace = initspace + else: + lastspace = '<' + initspace[:-1] + else: + lastspace = initspace + + return '\n' + initspace + firstsent + ' >\n' + code + '\n' + lastspace + +# }}} +# main function {{{ +if __name__ == "__main__": + option = {} + try: + opts, args = getopt.getopt(sys.argv[1:], 'ds', ['prefix=', 'help']) + for oa, ov in opts: + option[oa] = ov + + except getopt.GetoptError: + print >> STDERR, "Usage error: db2vim --help for usage" + sys.exit(1) + + if option.has_key('--help'): + usage(); + sys.exit(0); + + TOC_PREFIX = option.get('--prefix', 'ls_') + DEBUG = option.has_key('-d') + + if len(args) != 1: + print >> STDERR, "Usage error: db2vim --help for usage" + sys.exit(1) + + fileName = args[0] + FILENAME = re.sub(r'\.\w+$', r'.txt', fileName) + + try: + fp = open(fileName) + except: + print "Error opening xml file" + + dom = xml.dom.minidom.parse(fp) + + modeline = r''' +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') +================================================================================''' + + STRICT = option.has_key('-s') + + pattern = re.compile(r'\n([< ]*)([^\n]+)&codebegin;\n(.*?)&codeend;', re.DOTALL) + + processedDoc = handleElement(dom.documentElement) + while re.search('&codebegin;', processedDoc): + processedDoc = re.sub(pattern, replaceComment, processedDoc) + + urlsection = r""" +================================================================================ +URLs used in this file + +""" + labels = zip(URL_HASH.values(), URL_HASH.keys()) + labels.sort() + for label, url in labels: + urlsection += '*%s* : %s\n' % (label, url) + + processedDoc = processedDoc + urlsection + modeline + print processedDoc.encode('iso-8859-1') + +# }}} +# vim:et:sts=4:fdm=marker diff --git a/vim-latex/doc/db2vim/domutils.py b/vim-latex/doc/db2vim/domutils.py new file mode 100644 index 0000000..83351ff --- /dev/null +++ b/vim-latex/doc/db2vim/domutils.py @@ -0,0 +1,25 @@ +def GetTextFromElementNode(element, childNamePattern): + children = element.getElementsByTagName(childNamePattern) + texts = [] + for child in children: + texts.append(GetText(child.childNodes)) + + return texts + +def GetText(nodelist): + rc = "" + for node in nodelist: + if node.nodeType == node.TEXT_NODE: + rc = rc + node.data + return rc + +def GetTextFromElement(element): + text = "" + child = element.firstChild + while not child.nextSibling is None: + child = child.nextSibling + print child + if child.nodeType == child.TEXT_NODE: + text = text + child.data + + return text diff --git a/vim-latex/doc/db2vim/textutils.py b/vim-latex/doc/db2vim/textutils.py new file mode 100644 index 0000000..4c97c52 --- /dev/null +++ b/vim-latex/doc/db2vim/textutils.py @@ -0,0 +1,224 @@ +#!/usr/bin/env python +"""Contains functions to do word-wrapping on text paragraphs.""" + +import string +import re, random +import operator + +# JustifyLine(line, width): {{{ +def JustifyLine(line, width): + """Stretch a line to width by filling in spaces at word gaps. + + The gaps are picked randomly one-after-another, before it starts + over again. + + Author: Christopher Arndt <chris.arndt@web.de + """ + i = [] + while 1: + # line not long enough already? + if len(' '.join(line)) < width: + if not i: + # index list is exhausted + # get list if indices excluding last word + i = range(max(1, len(line)-1)) + # and shuffle it + random.shuffle(i) + # append space to a random word and remove its index + line[i.pop(0)] += ' ' + else: + # line has reached specified width or wider + return ' '.join(line) + + +# }}} +# FillParagraphs(text, width=80, justify=0): {{{ +def FillParagraphs(text, width=80, justify=0): + """Split a text into paragraphs and wrap them to width linelength. + + Optionally justify the paragraphs (i.e. stretch lines to fill width). + + Inter-word space is reduced to one space character and paragraphs are + always separated by two newlines. Indention is currently also lost. + + Author: Christopher Arndt <chris.arndt@web.de + """ + # split taxt into paragraphs at occurences of two or more newlines + paragraphs = re.split(r'\n\n+', text) + for i in range(len(paragraphs)): + # split paragraphs into a list of words + words = paragraphs[i].strip().split() + line = []; new_par = [] + while 1: + if words: + if len(' '.join(line + [words[0]])) > width and line: + # the line is already long enough -> add it to paragraph + if justify: + # stretch line to fill width + new_par.append(JustifyLine(line, width)) + else: + new_par.append(' '.join(line)) + line = [] + else: + # append next word + line.append(words.pop(0)) + else: + # last line in paragraph + new_par.append(' '.join(line)) + line = [] + break + # replace paragraph with formatted version + paragraphs[i] = '\n'.join(new_par) + # return paragraphs separated by two newlines + return '\n\n'.join(paragraphs) + +# }}} +# IndentParagraphs(text, width=80, indent=0, justify=0): {{{ +def IndentParagraphs(text, width=80, indent=0, justify=0): + """Indent a paragraph, i.e: + . left (and optionally right) justify text to given width + . add an extra indent if desired. + + This is nothing but a wrapper around FillParagraphs + """ + retText = re.sub(r"^|\n", "\g<0>" + " "*indent, \ + FillParagraphs(text, width, justify)) + retText = re.sub(r"\n+$", '', retText) + return retText + + +# }}} +# OffsetText(text, indent): {{{ +def OffsetText(text, indent): + return re.sub("^|\n", "\g<0>" + " "*indent, text) + + +# }}} +# RightJustify(lines, width): {{{ +def RightJustify(lines, width): + if width == 0: + width = TextWidth(lines) + text = "" + for line in lines.split("\n"): + text += " "*(width - len(line)) + line + "\n" + + text = re.sub('\n$', '', text) + return text + +# }}} +# CenterText(lines, width): {{{ +def CenterText(lines, width): + text = '' + for line in lines.split("\n"): + text += " "*(width/2 - len(line)/2) + line + '\n' + return text + +# }}} +# TextWidth(text): {{{ +def TextWidth(text): + """ + TextWidth(text) + + returns the 'width' of the text, i.e the length of the longest segment + in the text not containing new-lines. + """ + return max(map(len, text.split('\n'))) + + +# }}} +# FormatTable(tableText, ROW_SPACE=2, COL_SPACE = 3, \ {{{ +# COL_WIDTH=30, TABLE_WIDTH=80, justify=0): +def FormatTable(tableText, ROW_SPACE=2, COL_SPACE = 3, \ + COL_WIDTH=1000, justify=0, widths=None): + """ + FormatTable(tableText [, ROW_SPACE=2, COL_SPACE = 3, COL_WIDTH=30, justify=0]) + returns string + + Given a 2 dimensional array of text as input, produces a plain text + formatted string which resembles the table output. + + The optional arguments specify the inter row/column spacing and the + column width. + """ + + # first find out the max width of the columns + # maxwidths is a dictionary, but can be accessed exactly like an + # array because the keys are integers. + + if widths is None: + widths = {} + for row in tableText: + cellwidths = map(TextWidth, row) + for i in range(len(cellwidths)): + # Using: dictionary.get(key, default) + widths[i] = max(cellwidths[i], widths.get(i, -1)) + + # Truncate each of the maximum lengths to the maximum allowed. + for i in range(0, len(widths)): + widths[i] = min(widths[i], COL_WIDTH) + + if justify: + formattedTable = [] + + for row in tableText: + formattedTable.append(map(FillParagraphs, row, \ + [COL_WIDTH]*len(row))) + else: + formattedTable = tableText + + retTableText = "" + for row in formattedTable: + rowtext = row[0] + width = widths[0] + for i in range(1, len(row)): + rowtext = VertCatString(rowtext, width, " "*COL_SPACE) + rowtext = VertCatString(rowtext, width + COL_SPACE, row[i]) + + width = width + COL_SPACE + widths[i] + + retTableText += string.join(rowtext, "") + retTableText += "\n"*ROW_SPACE + + return re.sub(r"\n+$", "", retTableText) + + +# }}} +# VertCatString(string1, width1, string2): {{{ +def VertCatString(string1, width1, string2): + """ + VertCatString(string1, width1=None, string2) + returns string + + Concatenates string1 and string2 vertically. The lines are assumed to + be "\n" seperated. + + width1 is the width of the string1 column (It is calculated if left out). + (Width refers to the maximum length of each line of a string) + + NOTE: if width1 is specified < actual width, then bad things happen. + """ + lines1 = string1.split("\n") + lines2 = string2.split("\n") + + if width1 is None: + width1 = -1 + for line in lines1: + width1 = max(width1, len(line)) + + retlines = [] + for i in range(0, max(len(lines1), len(lines2))): + if i >= len(lines1): + lines1.append(" "*width1) + + lines1[i] = lines1[i] + " "*(width1 - len(lines1[i])) + + if i >= len(lines2): + lines2.append("") + + retlines.append(lines1[i] + lines2[i]) + + return string.join(retlines, "\n") + +# }}} + +# vim:et:sts=4:fdm=marker diff --git a/vim-latex/doc/imaps.txt b/vim-latex/doc/imaps.txt new file mode 100644 index 0000000..087b3db --- /dev/null +++ b/vim-latex/doc/imaps.txt @@ -0,0 +1,116 @@ + IMAP -- A fluid replacement for :imap + *imaps.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + + + + Abstract + ======== +This plugin provides a function IMAP() which emulates vims |:imap| function. The +motivation for providing this plugin is that |:imap| suffers from problems +which get increasingly annoying with a large number of mappings. + +Consider an example. If you do > + imap lhs something + + +then a mapping is set up. However, there will be the following problems: +1. The 'ttimeout' option will generally limit how easily you can type the lhs. + if you type the left hand side too slowly, then the mapping will not be + activated. + +2. If you mistype one of the letters of the lhs, then the mapping is deactivated + as soon as you backspace to correct the mistake. + +3. The characters in lhs are shown on top of each other. This is fairly + distracting. This becomes a real annoyance when a lot of characters initiate + mappings. + +This script provides a function IMAP() which does not suffer from these +problems. + + + + *imaps.txt-toc* +|im_1| Using IMAP + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Using IMAP *im_1* *imaps-usage* + + + +Each call to IMAP is made using the syntax: > + call IMAP (lhs, rhs, ft [, phs, phe]) + + +This is equivalent to having <lhs> map to <rhs> for all files of type <ft>. + +Some characters in the <rhs> have special meaning which help in cursor placement +as described in |imaps-placeholders|. The optional arguments define these +special characters. + +Example One: > + call IMAP ("bit`", "\\begin{itemize}\<cr>\\item <++>\<cr>\\end{itemize}<++>", "tex") + + +This effectively sets up the map for "bit`" whenever you edit a latex file. When +you type in this sequence of letters, the following text is inserted: > + \begin{itemize} + \item * + \end{itemize}<++> + +where * shows the cursor position. The cursor position after inserting the text +is decided by the position of the first "place-holder". Place holders are +special characters which decide cursor placement and movement. In the example +above, the place holder characters are <+ and +>. After you have typed in the +item, press <C-j> and you will be taken to the next set of <++>'s. Therefore by +placing the <++> characters appropriately, you can minimize the use of movement +keys. + +Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. + +Set g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd to something else if you +want different place holder characters. Also, b:Imap_PlaceHolderStart and +b:Imap_PlaceHolderEnd override the values of g:Imap_PlaceHolderStart and +g:Imap_PlaceHolderEnd respectively. This is useful for setting buffer specific +place holders. + +Example Two: You can use the <C-r> command to insert dynamic elements such as +dates. > + call IMAP ('date`', "\<c-r>=strftime('%b %d %Y')\<cr>", '') + + + +With this mapping, typing date` will insert the present date into the file. + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','--\ \ \ \ ','') +================================================================================ diff --git a/vim-latex/doc/latex-suite-chunk.xsl b/vim-latex/doc/latex-suite-chunk.xsl new file mode 100644 index 0000000..f9500bf --- /dev/null +++ b/vim-latex/doc/latex-suite-chunk.xsl @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0" + xmlns="http://www.w3.org/TR/xhtml1/transitional" + exclude-result-prefixes="#default"> + + <!-- $Id: latex-suite-chunk.xsl 1036 2008-05-31 16:10:30Z tmaas $ --> + + <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/> + + <!-- import common customizations --> + <xsl:import href="latex-suite-common.xsl"/> + + <!-- insert customization here --> + + <xsl:param name="default.encoding" select="'ISO-8859-1'"/> + + <xsl:param name="use.id.as.filename" select="'1'"/> + <xsl:param name="section.autolabel" select="1"/> + <xsl:param name="html.stylesheet" select="'../latex-suite.css'"/> + + <!-- Chunk the first top-level section? --> + <xsl:param name="chunk.first.sections" select="1"/> + <!-- Depth to which sections should be chunked --> + <xsl:param name="chunk.section.depth" select="2"/> + + <!-- How deep should recursive sections appear in the TOC? --> + <xsl:param name="toc.section.depth">2</xsl:param> + <!-- Control depth of TOC generation in sections --> + <xsl:param name="generate.section.toc.level" select="3"/> + + <xsl:param name="chunker.output.method" select="'html'"/> + + <xsl:param name="chunker.output.doctype-public" + select="'-//W3C//DTD HTML 4.01 Transitional//EN'"/> + <xsl:param name="chunker.output.doctype-system" + select="'http://www.w3.org/TR/html4/loose.dtd'"/> + + <!-- this enables generation of TOC in appendix --> + <xsl:param name="generate.toc"> +appendix toc +article/appendix toc +article toc +sect1 toc +sect2 toc +sect3 toc +sect4 toc +sect5 toc +section toc + </xsl:param> + +</xsl:stylesheet> diff --git a/vim-latex/doc/latex-suite-common.xsl b/vim-latex/doc/latex-suite-common.xsl new file mode 100644 index 0000000..2f44272 --- /dev/null +++ b/vim-latex/doc/latex-suite-common.xsl @@ -0,0 +1,62 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0" + xmlns="http://www.w3.org/TR/xhtml1/transitional" + exclude-result-prefixes="#default"> + + <!-- Common customizations for all stylesheets --> + + <!-- this omits the trailing '.' in numbered sections --> + <xsl:param name="autotoc.label.separator" select="' '"/> + <xsl:param name="local.l10n.xml" select="document('')"/> + + <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> + <l:l10n language="en"> + <l:context name="title-numbered"> + <l:template name="section" text="%n %t"/> + </l:context> + </l:l10n> + </l:i18n> + + <!-- override template for revhistory table --> + <xsl:template match="revhistory" mode="titlepage.mode"> + <xsl:variable name="numcols"> + <xsl:choose> + <xsl:when test="//authorinitials">3</xsl:when> + <xsl:otherwise>2</xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <div xmlns="http://www.w3.org/1999/xhtml" class="{name(.)}"> + <table border="2" cellspacing="4" width="100%" summary="Revision history"> + <tr> + <th align="left" valign="top" colspan="{$numcols}"> + <b> + <xsl:call-template name="gentext"> + <xsl:with-param name="key" select="'RevHistory'"/> + </xsl:call-template> + </b> + </th> + </tr> + <xsl:apply-templates mode="titlepage.mode"> + <xsl:with-param name="numcols" select="$numcols"/> + </xsl:apply-templates> + </table> + </div> + </xsl:template> + + <!-- + <xsl:template name="user.header.content"> + <div id="customheader"> + <span class="logo">TeX Refs</span> + </div> + </xsl:template> + + <xsl:template name="user.footer.content"> + <div id="customfooter"> + Copyright © 2002 P. Karp, M. Wiedmann + </div> + </xsl:template> + --> + +</xsl:stylesheet> diff --git a/vim-latex/doc/latex-suite-quickstart.css b/vim-latex/doc/latex-suite-quickstart.css new file mode 100644 index 0000000..52c746e --- /dev/null +++ b/vim-latex/doc/latex-suite-quickstart.css @@ -0,0 +1,182 @@ +/* + * Authors: Srinath Avadhanula and Mikolaj Machowski + * This style file borrows some elements from main.css, the style file used + * in cream.sf.net + * + * */ +P { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +DT { + font-size : 11pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +LI { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} + +DIV.header { + margin : 0.5cm ; + width : 800px ; + height : 100 +} +.note { +} + +TD { + font-size : 11pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +TD.menu { + text-align : center ; + font-family : verdana, helvetica, sans-serif +} +TD.footright { + text-align : right ; + font-size : 10pt ; + font-family : verdana, helvetica, sans-serif +} +TD.leftpanel { + font-size: 14px ; + font-family: verdana, helvetica, sans-serif ; + vertical-align: top ; + width: 150px; + padding: 15px; + background-color: #88aaaa; +} +TD.mainpanel { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; + padding: 15px; +} +TD.footpanel { + font-size: 12px ; + font-family: verdana, helvetica, sans-serif ; + vertical-align: top ; + text-align: right; + padding: 5px; + background-color: #88aaaa; +} +.navigation { + vertical-align: top; + width: 150px; + padding: 15px; + background-color: #445555; + color: #fffcfc; +} +.navheader { + margin-top: -0.5em; + margin-bottom: 0.5em; + text-align: right; + color: #446644; + font-size: 14px; + font-weight: bold; +} + +SPAN.menu { + text-align : center ; + font-size : 12pt ; + font-family : verdana, helvetica, sans-serif +} + +DIV.merit { + margin : 0.5cm ; + width : 800px +} + +TABLE.meritum { + margin : 0.5cm ; + border : 0 +} +.foot { + margin : 0.5cm ; + width : 800px +} +.head { + margin : 0.5cm ; +} + +CODE { + font-family: "Andale Mono", "Courier New", "Courier", monospace; + background-color: #eef0f3; + white-space: nowrap; +} + +.singlesmall { + font-size: 14px; +} + +.doublesmall { + font-size: 12px; +} + + +DIV.footer { + margin : 0.5cm ; + width : 800px +} +.qa { + margin : 0.5cm ; + font-size : 16px; + font-weight : bold; +} +.ans { + margin : 0.5cm ; + font-weight : normal; +} + +H2.hline { + text-align : center ; + font-family : verdana, helvetica, sans-serif +} + +A.extlinks { + font-size : 11pt ; + font-family : verdana, helvetica, sans-serif ; + font-weight : bold +} + +TT { + font-family: courier,sans-serif; + font-size: 11pt; +} +PRE.programlisting { + font-family: courier,sans-serif; + font-size: 10pt; + background-color:#eef0f3; + border-color: #000000; + border-width: 1px; + border-style: solid; +} +SPAN.conflict { + font-size : small ; + font-family: courier,sans-serif; + color : #DD4444; +} +HR.navig { + color: #446644; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} +A.question { + color: #000000; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} +A.question:hover { + color: #000000; + background-color: #eef0f3; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} + diff --git a/vim-latex/doc/latex-suite-quickstart.txt b/vim-latex/doc/latex-suite-quickstart.txt new file mode 100644 index 0000000..a3ec8c0 --- /dev/null +++ b/vim-latex/doc/latex-suite-quickstart.txt @@ -0,0 +1,448 @@ + A (very) quick introduction to Latex-Suite + *latex-suite-quickstart.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + + + + Abstract + ======== +Latex-Suite is a comprehensive set of scripts to aid in editing, compiling and +viewing LaTeX documents. A thorough explanation of the full capabilities of +Latex-Suite is described in the user manual. This guide on the other hand, +provides a quick 30-45 minute running start to some of the more commonly used +functionalities of Latex-Suite. + + *latex-suite-quickstart.txt-toc* +|lq_1| Using this tutorial +|lq_2| Inserting a template +|lq_3| Inserting a package +|lq_4| Inserting an Environment +|lq_5| A few keyboard shortcuts +|lq_6| Folding in Latex-Suite +|lq_7| Inserting a Reference +|lq_8| Compiling a document + |lq_8_1| Debugging LaTeX source files +|lq_9| Viewing DVI files + |lq_9_1| Performing forward searches + |lq_9_2| Performing inverse searches +|lq_10| Conclusions + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Using this tutorial *lq_1* *lq_a_bc* + *lsq-using-tutorial* + + + +This tutorial assumes that you have vim version 6.1+ installed on your machine. +To check, open vim and type > + :ver +You will see the version in the first line of the output. Get the latest vim +version from http://vim.sf.net |lq_u_1|. + +Assuming you have Vim 6.1+ already up and running, follow the instructions here +|lq_u_2| to set up Latex-Suite. Remember to make sure your 'grepprg' setting of +Vim works. + +Good, now you are all set to start the tutorial. Since this tutorial aims to +explain the newbie-friendly version of Latex-Suite, it needs some GUI +functionality. Therefore, at least for this tutorial, open the gui version of +vim. (On MS windows, this is the default). Open up this help file in either the +same gvim session in a split window or in a different session and follow the +(friendly) instructions. + +================================================================================ +Inserting a template *lq_2* *lq_a_bd* + *lsq-inserting-template* + + + +Start up gvim and begin editing a new file. > + e newfile.tex +If the installation went well, you should see a new set of menus appear. Goto +Tex-Suite > Templates. You will see a number of templates to choose from. For +now, choose to insert a template for an article. You should get the following in +the main vim window (after possibly a hit-enter prompt). > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Sun Jun 22 04:00 PM 2003 P + 4 % + 5 \documentclass[a4paper]{article} + 6 \begin{document} + 7 + 8 \end{document} + 9 + 10 ~ + 11 ~ + 12 ~ + 13 ~ + -- INSERT -- 7,1 All + + + +The cursor is left on line 7 (just after the \begin{document} line) from where +you can start typing straight away. Trying to lessen movement is a recurring +theme in Latex-Suite. + +================================================================================ +Inserting a package *lq_3* *lq_a_be* + *lsq-lsq-inserting-package* + + + +Assume that we are writing a mathematical paper and we want to use the popular +amsmath package. We will use some functionality which Latex-Suite provides +specifically for including LaTeX packages, providing options etc. Navigate to +before the \begin{document} line (The portion of the document before the +\begin{document} is called the _preamble_ in LaTeX). On an empty line in the +preamble, type the single word amsmath and then press <F5> in normal mode. The +line will change to > + \usepackage[]{amsmath}<++> +with the cursor positioned conveniently between the []'s. For now, do not worry +about the trailing <++> at the end of this line. Assume we want to provide the +sumlimits options to amsmath. You can either type in this option manually, or +choose from a menu of package options which Latex-Suite automatically creates +when you insert a package using <F5>. With the cursor still placed between the +[], goto TeX-Suite > Packages > amsmath Options. Choose the sumlimits option. +The package line should get converted to: > + \usepackage[sumlimits,]{amsmath}<++> + + +with the cursor before ]. Press <C-j> in insert mode. You will see the cursor +jump to the end of the package line and the trailing <++> will disappear. What +just happened?! You had your first taste of _Placeholders_. Read more about them +(later) here |lq_u_3|. In short, pressing <C-j> in insert mode takes you to the +next <++> in the text. + +================================================================================ +Inserting an Environment *lq_4* *lq_a_bf* + *lsq-insert-environment* + + + +Now let us type in a simple formula in LaTeX. Move back to the body of the +document (The portion of the document between \begin{document} and +\end{document} is called the body). Type in a few simple sentences and then on +an empty line, type the single word eqnarray. Escape to normal mode and press +<F5>. (Remember: <F5> is very useful!) This time, the line will change to: > + \begin{eqnarray} + \label{}<++> + \end{eqnarray}<++> +<with the cursor between the {}. Enter a label. We will use eqn:euler. After +typing in eqn:euler, press <C-j>. This will take you outside the curly-braces. +Another time you used a Placeholder! + +================================================================================ +A few keyboard shortcuts *lq_5* *lq_a_bg* + *lsq-keyboard-shortcuts* + + + +Now to type in the famous Euler formula. Our aim is to type > + e^{j\pi} + 1 &=& 0 +Instead of typing this blindly, let us use a few shortcuts to reduce movement. +Start out by typing e^. Now instead of typing {, type another ^. You will see +the e^^ change instantly to e^{}<++> with the cursor between {}'s. (The ^^ +changed to ^{}<++>.) Continue with the following sequence of letters: j`p. This +will change instantly to j\pi. (The `p changed to \pi.) Having typed in all we +need to type between the {}'s, press <C-j>. You will pop back out of the +curly-braces. Continue typing the rest of the formula. You can use == as a +shortcut for &=&. Latex-Suite provides a large number of such shortcuts which +should making typing much more fun and fast if you get acquainted with them. A +list is provided here |lq_u_4|. Definitely spend some time getting a feel for +them. Most of them are pretty intuitive like `/ for \frac{}{}, `8 for \infty +etc. + +In order to understand the next section better, it will be helpful to have one +more \label. Lets use the handy <F5> key to insert another equation. This time +something simple like the following will do: > + \begin{eqnarray} + \label{eqn:simple} + 1 + 1 = 2 + \end{eqnarray} + + +================================================================================ +Folding in Latex-Suite *lq_6* *lq_a_bh* *lsq-folding* + + + +Okay, we have typed enough. At this stage, hopefully, your file is looking +something like this: > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 \documentclass[a4paper]{article} + 6 + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 \begin{eqnarray} + 18 \label{eqn:simple} + 19 1 + 1 &=& 2 + 20 \end{eqnarray} + 21 This is my contribution to mathematics. + 22 \end{document} + +In normal mode, press \rf. This will fold up the entire file and you should see +the file looking as below: > + + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 +-- 4 lines: Preamble: \documentclass[a4paper]{article} ----- + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) \label{eqn:euler} ----------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 10 +-- 4 lines: eqnarray (eqn:simple) \label{eqn:simple} --------- + 21 This is my contribution to mathematics. + 22 \end{document} + +What has happened is that Latex-Suite folded away blocks of LaTeX code into +folded regions. You can open and close folds by using the command za in normal +mode. + +================================================================================ +Inserting a Reference *lq_7* *lq_a_bi* + *lsq-inserting-reference* + + + +A necessary part of LaTeX editing is referencing equations, figures, +bibliographic entries etc. This is done with the \ref and the \cite commands. +Latex-Suite provides an easy way to do this. Somewhere in the body of the +document, type in the following sentence > + This is a reference to (\ref{}). +With the cursor between the {} press <F9> in insert mode. Your vim session will +sprout two new windows and it should look like below: > + + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) : \label{eqn:euler}----------------------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 +-- 4 lines: eqnarray (eqn:simple) : \label{eqn:simple}--------------------- + 21 This is my contribution to mathematics. + 22 This is a reference to (\ref{}<++>)<++> + 23 \end{document} + ~ + ~ + ~ + test.tex [+] 22,29 Bot + test.tex|11| \label{eqn:euler} + test.tex|18| \label{eqn:simple} + ~ + ~ + ~ + [Error List] 1,1 All + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + test.tex [Preview][+] 11,2-5 46% + + + +The cursor will relocate to the middle window which shows all \labels found in +all the .tex file in the current directory. You can scroll up and down in the +middle window till you reach the reference you want to insert. Notice how when +you scroll in the middle window, the bottom "Preview" window scrolls +automatically to show you the location of the current selection. This helps you +identify the reference with greater ease because often times, \labels are not +descriptive enough or there might be too many of them. To insert the reference, +just position the cursor on the relevant line in the middle window and press +<enter>. The line which you were editing will change to: > + This is a reference to (\ref{eqn:euler}) +<and the bottom windows close automatically. + +The <F9> key also works for inserting \cite commands to reference bibliographic +entries, inserting file names for the \inputgraphics command and just plain +searching for words. Click here |lq_u_5| for more information. + +================================================================================ +Compiling a document *lq_8* *lq_a_bj* + *lsq-compiling* + +|lq_8_1| Debugging LaTeX source files + + +Great! We have just created a small latex file. The next step is to make the +latex compiler create a .dvi file from it. Compiling via latex-suite is simple. +Goto normal mode and press \ll (replace \ with whatever mapleader setting you +have). This will call the latex compiler. If all goes well, then the focus +should return to the vim window. + +Nothing happend? Ouch! You might need to do some additional settings as +described here. |lq_u_6| + + +-------------------------------------------------------------------------------- +Debugging LaTeX source files *lq_8_1* *lq_a_bk* + *lsq-debugging* + +To illustrate the debugging procedure, let's create a few mistakes in the file. +Insert the following ``mistakes'' in the file: > + This is a $\mistake$. + And this is $\another$ +Now press \ll again. This time you will notice that after compilation finishes, +the cursor automatically lands on $\mistake$. In addition, 2 new windows will +appear as shown here: + +The middle window is an _Error List_ window showing you the errors which the +latex compiler found. Th bottom window is a _Log Preview_ window, which shows +you the context of the error made by displaying the relevant portion of the .log +file created during the latex compilation procedure. Jump to the _Error List_ +window and try scrolling around in it using either the j, k keys or the arrow +keys. You will notice that the _Log Preview_ window scrolls automatically to +retain the context of the error you are currently located on. If you press +<enter> on any line, you will see the cursor jump to the location of the error. +Latex-Suite tries to guess the column location as best as it can so you can +continue typing straight away. +Having got a taste for compiling, proceed by deleting the erroneous lines and +re-compiling. + +The Latex-Suite compiler is capable of much more including selectively filtering +out common errors which you might want to ignore for the moment, compiling parts +of a document, setting levels of verbosity in the compiler output etc. See here +|lq_u_7| for more. + +================================================================================ +Viewing DVI files *lq_9* *lq_a_bl* + *lsq-viewing-dvi* + +|lq_9_1| Performing forward searches +|lq_9_2| Performing inverse searches + + +Now that you have compiled your first latex source, its time to view it. Again, +this should be pretty simple. Press \lv in normal mode. Depending on your +platform, a DVI viewer program should open up and display the dvi file generated +in compilation step previously. + +Nothing happend? Ouch! You might need to do some additional settings as +described here. |lq_u_8| + + +-------------------------------------------------------------------------------- +Performing forward searches *lq_9_1* *lq_a_bm* + *lsq-quick-forward-searching* + +If you are using a modern DVI viewer, then it is possible to do what is called +forward and inverse searching. However, you will need to customize the standard +Latex-Suite distribution in order to utilize this functionality. Type in the +following on the command line: > + :let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode $*' + :TCTarget dvi + + +Now recompile the latex file by pressing \ll. This time, instead of pressing \lv +to view the file, press \ls from within the tex file. If the DVI viewer supports +forward searching (most of them do), then the viewer will actually display the +portion of the DVI file corresponding to the location where you were editing the +tex file. + +NOTE: The reason Latex-Suite does not have this setting by default is that on + some systems this causes unpredictable results in the DVI output. If you + find the DVI output satisfactory, then you can insert the first of the 2 + lines above into your $VIM/ftplugin/tex.vim file. $VIM is ~/vimfiles for + windows and ~/.vim for *nix machines. + + + +-------------------------------------------------------------------------------- +Performing inverse searches *lq_9_2* *lq_a_bn* + *lsq-quick-inverse-searching* + +Most DVI viewers also support inverse searching, whereby you can make the DVI +viewer ask vim to display the tex source corresponding to the DVI file being +shown. This is extremely helpful while proofreading large documents. + +Simply double-click anywhere in the viewer window. If the viewer supports it, +then it will attempt to open an editor window at the location corresponding to +where you double-clicked. On *nix platforms, Latex-Suite attempts to start the +viewer program in such a way that it already knows to use vim to open the tex +source. Thus you should see a vim window open up showing the tex file. However, +if there is an error, or some other program is used, you will need to tell the +viewer program to use gvim as the editor. On windows platforms, if you use the +commonly available yap viewer (available as part of the miktex distribution), +then this option can be set from View > Options > Inverse Search. In the Command +line: window, write > + "C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f" +(Customize the path according to where you have installed gvim). If you double +click in the view pane now, you will see gvim start up and take you to the +relevant portion of the tex file. + +================================================================================ +Conclusions *lq_10* *lq_a_bo* + *lsq-conclusions* + + + +Thats all folks! By now, you should know enough of the basic functions of +latex-suite. Ofcourse, latex-suite is capable of much, much more such as +compiling files multiple times to resolve changed labels, compiling +dependencies, handling user packages and more. To get a feel for that, you will +need to take a look at the Latex-Suite user manual. |lq_u_9| + +================================================================================ +URLs used in this file + +*lq_u_1* : http://vim.sf.net +*lq_u_2* : http://vim-latex.sourceforge.net/index.php?subject=download&title=Download +*lq_u_3* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-macros.html +*lq_u_4* : http://vim-latex.sourceforge.net/documentation/latex-suite/auc-tex-mappings.html +*lq_u_5* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-completion.html +*lq_u_6* : http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-2 +*lq_u_7* : http://vim-latex.sourceforge.net/documentation/latex-suite/latex-compiling.html +*lq_u_8* : http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-3 +*lq_u_9* : http://vim-latex.sourceforge.net/index.php?subject=manual&title=Manual#user-manual + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') +================================================================================ diff --git a/vim-latex/doc/latex-suite-quickstart.xml b/vim-latex/doc/latex-suite-quickstart.xml new file mode 100644 index 0000000..da3e995 --- /dev/null +++ b/vim-latex/doc/latex-suite-quickstart.xml @@ -0,0 +1,471 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> + +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "docbook-xml/docbookx.dtd" +[<!ENTITY dummy "dummy"> +<!ENTITY date "$Date$"> +<!ENTITY ls "Latex-Suite"> +<!ENTITY latex "LaTeX"> +<!ENTITY vim "Vim"> +<!ENTITY ph "<++>"> +]> +<article lang="en"> + <articleinfo id="lsq-articleinfo"> + + <title id="lsq-articleinfo-title">A (very) quick introduction to Latex-Suite</title> + + <author> + <firstname>Srinath</firstname> + <surname>Avadhanula</surname> + <affiliation> + <address><email>srinath AT fastmail DOT fm</email></address> + </affiliation> + </author> + + <abstract> + &ls; is a comprehensive set of scripts to aid in editing, compiling and + viewing &latex; documents. A thorough explanation of the full + capabilities of &ls; is described in the user manual. This guide on the + other hand, provides a quick 30-45 minute running start to some of the + more commonly used functionalities of &ls;. + </abstract> + + <date>&date;</date> + + </articleinfo> + <section id="lsq-using-tutorial"> + <title id="using-tutorial">Using this tutorial</title> + <para> + This tutorial assumes that you have vim version 6.1+ installed on your + machine. To check, open vim and type + <programlisting>:ver</programlisting> + You will see the version in the first line of the output. Get the latest + vim version from <ulink url="http://vim.sf.net">http://vim.sf.net</ulink>. + </para> + <para> + Assuming you have Vim 6.1+ already up and running, follow the + instructions <ulink + url="http://vim-latex.sourceforge.net/index.php?subject=download&title=Download">here</ulink> + to set up Latex-Suite. Remember to make sure your + <literal>'grepprg'</literal> setting of &vim; works. + </para> + <para> + Good, now you are all set to start the tutorial. Since this tutorial + aims to explain the newbie-friendly version of &ls;, it needs some GUI + functionality. Therefore, at least for this tutorial, open the gui + version of vim. (On MS windows, this is the default). Open up this help + file in either the same gvim session in a split window or in a different + session and follow the (friendly) instructions. + </para> + </section> + <section id="lsq-inserting-template"> + <title id="inserting-template-title">Inserting a template</title> + <para> + Start up gvim and begin editing a new file. + <programlisting>e newfile.tex</programlisting> + If the installation went well, you should see a new set of + menus appear. Goto <literal>Tex-Suite > Templates</literal>. You will see + a number of templates to choose from. For now, choose to insert a + template for an article. You should get the following in the main + vim window (after possibly a hit-enter prompt). + <programlisting> + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Sun Jun 22 04:00 PM 2003 P + 4 % + 5 \documentclass[a4paper]{article} + 6 \begin{document} + 7 + 8 \end{document} + 9 + 10 ~ + 11 ~ + 12 ~ + 13 ~ +-- INSERT -- 7,1 All +</programlisting> + </para> + <imageobject> + <imagedata fileref="" format="png"></imagedata> + </imageobject> + <para> + The cursor is left on line 7 (just after the + <literal>\begin{document}</literal> line) from where you can start + typing straight away. Trying to lessen movement is a recurring theme in + Latex-Suite. + </para> + </section> + <section id="lsq-lsq-inserting-package"> + <title>Inserting a package</title> + <para> + Assume that we are writing a mathematical paper and we want to use the + popular amsmath package. We will use some functionality which + Latex-Suite provides specifically for including LaTeX packages, + providing options etc. Navigate to before the + <literal>\begin{document}</literal> line (The portion of the document + before the <literal>\begin{document}</literal> is called the + <emphasis>preamble</emphasis> in LaTeX). On an empty line in the + preamble, type the single word <literal>amsmath</literal> and then press + <literal><F5></literal> in normal mode. The line will change to + <programlisting>\usepackage[]{amsmath}&ph;</programlisting> + with the cursor positioned conveniently between the + <literal>[]</literal>'s. For now, do not worry about the trailing + <literal>&ph;</literal> at the end of this line. Assume we want to + provide the <literal>sumlimits</literal> options to amsmath. You can + either type in this option manually, or choose from a menu of package + options which Latex-Suite automatically creates when you insert a + package using <literal><F5></literal>. With the cursor still + placed between the <literal>[]</literal>, goto <literal>TeX-Suite > + Packages > amsmath Options</literal>. Choose the + <literal>sumlimits</literal> option. The package line should get + converted to: + <programlisting>\usepackage[sumlimits,]{amsmath}&ph;</programlisting> + </para> + <para> + with the cursor before <literal>]</literal>. Press + <literal><C-j></literal> in insert mode. You will see the cursor + jump to the end of the package line and the trailing + <literal>&ph;</literal> will disappear. What just happened?! You had + your first taste of <emphasis>Placeholders</emphasis>. Read more about + them (later) <ulink + url="http://vim-latex.sourceforge.net/documentation/latex-suite/latex-macros.html">here</ulink>. + In short, pressing <literal><C-j></literal> in insert mode takes + you to the next <literal>&ph;</literal> in the text. + </para> + </section> + <section id="lsq-insert-environment"> + <title>Inserting an Environment</title> + <para> + Now let us type in a simple formula in LaTeX. Move back to the body of + the document (The portion of the document between + <literal>\begin{document}</literal> and + <literal>\end{document}</literal> is called the body). Type in a few + simple sentences and then on an empty line, type the single word + <literal>eqnarray</literal>. Escape to normal mode and press + <literal><F5></literal>. (Remember: + <literal><F5></literal> is very useful!) This time, the line will + change to: + <programlisting>\begin{eqnarray} + \label{}&ph; +\end{eqnarray}&ph;</programlisting> + with the cursor between the <literal>{}</literal>. Enter a label. We + will use <literal>eqn:euler</literal>. After typing in + <literal>eqn:euler</literal>, press <literal><C-j></literal>. This + will take you outside the curly-braces. Another time you used a + Placeholder! + </para> + </section> + <section id="lsq-keyboard-shortcuts"> + <title>A few keyboard shortcuts</title> + <para> + Now to type in the famous Euler formula. Our aim is to type + <programlisting>e^{j\pi} + 1 &=& 0</programlisting> Instead + of typing this blindly, let us use a few shortcuts to reduce + movement. Start out by typing <literal>e^</literal>. Now instead of + typing <literal>{</literal>, type another <literal>^</literal>. You + will see the <literal>e^^</literal> change instantly to + <literal>e^{}&ph;</literal> with the cursor between + <literal>{}</literal>'s. (The <literal>^^</literal> changed to + <literal>^{}&ph;</literal>.) Continue with the following sequence of + letters: <literal>j`p</literal>. This will change instantly to + <literal>j\pi</literal>. (The <literal>`p</literal> changed to + <literal>\pi</literal>.) Having typed in all we need to type between + the <literal>{}</literal>'s, press <literal><C-j></literal>. + You will pop back out of the curly-braces. Continue typing the rest + of the formula. You can use <literal>==</literal> as a shortcut for + <literal>&=&</literal>. Latex-Suite provides a large number + of such shortcuts which should making typing much more fun and fast + if you get acquainted with them. A list is provided <ulink + url="http://vim-latex.sourceforge.net/documentation/latex-suite/auc-tex-mappings.html">here</ulink>. Definitely spend some time getting a feel for + them. Most of them are pretty intuitive like <literal>`/</literal> + for <literal>\frac{}{}</literal>, <literal>`8</literal> for + <literal>\infty</literal> etc. + </para> + <para> + In order to understand the next section better, it will be helpful + to have one more <literal>\label</literal>. Lets use the handy + <literal><F5></literal> + key to insert another equation. This time something simple like the + following will do: + <programlisting>\begin{eqnarray} + \label{eqn:simple} + 1 + 1 = 2 +\end{eqnarray}</programlisting> + </para> + </section> + <section id="lsq-folding"> + <title>Folding in &ls;</title> + <para> + Okay, we have typed enough. At this stage, hopefully, your file is + looking something like this: +<programlisting> + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 \documentclass[a4paper]{article} + 6 + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 \begin{eqnarray} + 18 \label{eqn:simple} + 19 1 + 1 &=& 2 + 20 \end{eqnarray} + 21 This is my contribution to mathematics. + 22 \end{document} +</programlisting> + In normal mode, press <literal>\rf</literal>. This will fold up the + entire file and you should see the file looking as below: +<programlisting> + 1 % File: sample.tex + 2 % Created: Sun Jun 22 04:00 PM 2003 P + 3 % Last Change: Mon Dec 15 07:00 PM 2003 + 4 % + 5 +-- 4 lines: Preamble: \documentclass[a4paper]{article} ----- + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) \label{eqn:euler} ----------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 10 +-- 4 lines: eqnarray (eqn:simple) \label{eqn:simple} --------- + 21 This is my contribution to mathematics. + 22 \end{document} +</programlisting> + What has happened is that &ls; folded away blocks of &latex; code into + folded regions. You can open and close folds by using the command + <literal>za</literal> in normal mode. + </para> + </section> + <section id="lsq-inserting-reference"> + <title>Inserting a Reference</title> + <para> + A necessary part of LaTeX editing is referencing equations, figures, + bibliographic entries etc. This is done with the + <literal>\ref</literal> and the <literal>\cite</literal> commands. + Latex-Suite provides an easy way to do this. Somewhere in the body of + the document, type in the following sentence + <programlisting>This is a reference to (\ref{}).</programlisting> + With the cursor between the <literal>{}</literal> press + <literal><F9></literal> in insert mode. Your vim session will + sprout two new windows and it should look like below: +<programlisting> + 9 \begin{document} + 10 +-- 4 lines: eqnarray (eqn:euler) : \label{eqn:euler}----------------------- + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: + 17 +-- 4 lines: eqnarray (eqn:simple) : \label{eqn:simple}--------------------- + 21 This is my contribution to mathematics. + 22 This is a reference to (\ref{}<++>)<++> + 23 \end{document} +~ +~ +~ +test.tex [+] 22,29 Bot +test.tex|11| \label{eqn:euler} +test.tex|18| \label{eqn:simple} +~ +~ +~ +[Error List] 1,1 All + 7 \usepackage[sumlimits,]{amsmath} + 8 + 9 \begin{document} + 10 \begin{eqnarray} + 11 \label{eqn:euler} + 12 e^{j\pi} + 1 &=& 0 + 13 \end{eqnarray} + 14 This is the famous euler equation. I + 15 will type another equation, just as + 16 true: +test.tex [Preview][+] 11,2-5 46% +</programlisting> + </para> + <imageobject> + <imagedata fileref="" format=""></imagedata> + </imageobject> + <para> + The cursor will relocate to the middle window which shows all + <literal>\label</literal>s found in all the <literal>.tex</literal> file + in the current directory. + You can scroll up and down in the middle window till you reach the + reference you want to insert. Notice how when you scroll in the + middle window, the bottom "Preview" window scrolls automatically to + show you the location of the current selection. This helps you + identify the reference with greater ease because often times, + <literal>\labels</literal> are not descriptive enough or there might be too + many of them. To insert the reference, just position the cursor on + the relevant line in the middle window and press + <literal><enter></literal>. The line which you were editing will change + to: + <programlisting>This is a reference to (\ref{eqn:euler})</programlisting> + and the bottom windows close automatically. + </para> + <para> + The <literal><F9></literal> key also works for inserting + <literal>\cite</literal> commands to reference bibliographic entries, + inserting file names for the <literal>\inputgraphics</literal> command + and just plain searching for words. Click <ulink + url="http://vim-latex.sourceforge.net/documentation/latex-suite/latex-completion.html">here</ulink> + for more information. + </para> + </section> + <section id="lsq-compiling"> + <title>Compiling a document</title> + <para> + Great! We have just created a small latex file. The next step is to + make the latex compiler create a .dvi file from it. Compiling via + latex-suite is simple. Goto normal mode and press <literal>\ll</literal> + (replace <literal>\</literal> with whatever <literal>mapleader</literal> setting you + have). This will call the latex compiler. If all goes well, then + the focus should return to the vim window. + </para> + <para> + Nothing happend? Ouch! You might need to do some additional settings as + described <ulink + url="http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-2">here.</ulink> + </para> + <section id="lsq-debugging"> + <title>Debugging LaTeX source files</title> + <para> + To illustrate the debugging procedure, let's create a few mistakes + in the file. Insert the following ``mistakes'' in the file: + <programlisting>This is a $\mistake$. +And this is $\another$</programlisting> + Now press <literal>\ll</literal> again. This time you will notice that + after compilation finishes, the cursor automatically lands on + <literal>$\mistake$</literal>. In addition, 2 new windows will appear + as shown here: + </para> + <imageobject> + <imagedata fileref="" format=""></imagedata> + </imageobject> + <para> + The middle window is an <emphasis>Error List</emphasis> window + showing you the errors which the latex compiler found. Th bottom + window is a <emphasis>Log Preview</emphasis> window, which shows you + the context of the error made by displaying the relevant portion of + the <literal>.log</literal> file created during the latex + compilation procedure. Jump to the <emphasis>Error List</emphasis> + window and try scrolling around in it using either the <literal>j, + k</literal> keys or the arrow keys. You will notice that the + <emphasis>Log Preview</emphasis> window scrolls automatically to + retain the context of the error you are currently located on. If you + press <literal><enter></literal> on any line, you will see the + cursor jump to the location of the error. Latex-Suite tries to guess + the column location as best as it can so you can continue typing + straight away. + </para> + </section> + <para> + Having got a taste for compiling, proceed by deleting the erroneous + lines and re-compiling. + </para> + <para> + The Latex-Suite compiler is capable of much more including + selectively filtering out common errors which you might want to + ignore for the moment, compiling parts of a document, setting + levels of verbosity in the compiler output etc. See <ulink + url="http://vim-latex.sourceforge.net/documentation/latex-suite/latex-compiling.html">here</ulink> + for more. + </para> + </section> + <section id="lsq-viewing-dvi"> + <title>Viewing DVI files</title> + <para> + Now that you have compiled your first latex source, its time to + view it. Again, this should be pretty simple. Press + <literal>\lv</literal> in normal mode. Depending on your platform, a DVI + viewer program should open up and display the dvi file generated in + compilation step previously. + </para> + <para> + Nothing happend? Ouch! You might need to do some additional settings as + described <ulink + url="http://vim-latex.sourceforge.net/index.php?subject=faq&title=FAQ#faq-3">here.</ulink> + </para> + <section id="lsq-quick-forward-searching"> + <title>Performing forward searches</title> + <para> + If you are using a modern DVI viewer, then it is possible to do what + is called forward and inverse searching. However, you will need to + customize the standard Latex-Suite distribution in order to utilize + this functionality. Type in the following on the command line: + + <programlisting>:let g:Tex_CompileRule_dvi = 'latex -src-specials -interaction=nonstopmode $*' +:TCTarget dvi</programlisting> + + Now recompile the latex file by pressing <literal>\ll</literal>. + This time, instead of pressing <literal>\lv</literal> to view the + file, press <literal>\ls</literal> from within the tex file. If the + DVI viewer supports forward searching (most of them do), then the + viewer will actually display the portion of the DVI file + corresponding to the location where you were editing the tex file. + </para> + <note> + <para> + The reason Latex-Suite does not have this setting by default is + that on some systems this causes unpredictable results in the DVI + output. If you find the DVI output satisfactory, then you can + insert the first of the 2 lines above into your + <literal>$VIM/ftplugin/tex.vim</literal> file. + <literal>$VIM</literal> is <literal>~/vimfiles</literal> for + windows and <literal>~/.vim</literal> for *nix machines. + </para> + </note> + </section> + <section id="lsq-quick-inverse-searching"> + <title>Performing inverse searches</title> + <para> + Most DVI viewers also support inverse searching, whereby you can + make the DVI viewer ask vim to display the tex source corresponding + to the DVI file being shown. This is extremely helpful while + proofreading large documents. + </para> + + <para> + Simply double-click anywhere in the viewer window. If the viewer + supports it, then it will attempt to open an editor window at the + location corresponding to where you double-clicked. On *nix + platforms, Latex-Suite attempts to start the viewer program in such + a way that it already knows to use vim to open the tex source. Thus + you should see a vim window open up showing the tex file. However, + if there is an error, or some other program is used, you will need + to tell the viewer program to use gvim as the editor. On windows + platforms, if you use the commonly available <literal>yap</literal> + viewer (available as part of the miktex distribution), then this + option can be set from <literal>View > Options > Inverse + Search</literal>. In the <literal>Command line:</literal> window, + write + <programlisting>"C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f"</programlisting> + (Customize the path according to where you have installed gvim). + If you double click in the view pane now, you will see gvim start + up and take you to the relevant portion of the tex file. + </para> + </section> + </section> + <section id="lsq-conclusions"> + <title>Conclusions</title> + <para> + Thats all folks! By now, you should know enough of the basic functions + of latex-suite. Ofcourse, latex-suite is capable of much, much more such + as compiling files multiple times to resolve changed labels, compiling + dependencies, handling user packages and more. To get a feel for that, + you will need to take a look at the <ulink + url="http://vim-latex.sourceforge.net/index.php?subject=manual&title=Manual#user-manual">&ls; + user manual.</ulink> + </para> + </section> +</article> + +<!-- +vim: et:sw=1:ts=1 +--> diff --git a/vim-latex/doc/latex-suite.css b/vim-latex/doc/latex-suite.css new file mode 100644 index 0000000..52c746e --- /dev/null +++ b/vim-latex/doc/latex-suite.css @@ -0,0 +1,182 @@ +/* + * Authors: Srinath Avadhanula and Mikolaj Machowski + * This style file borrows some elements from main.css, the style file used + * in cream.sf.net + * + * */ +P { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +DT { + font-size : 11pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +LI { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} + +DIV.header { + margin : 0.5cm ; + width : 800px ; + height : 100 +} +.note { +} + +TD { + font-size : 11pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; +} +TD.menu { + text-align : center ; + font-family : verdana, helvetica, sans-serif +} +TD.footright { + text-align : right ; + font-size : 10pt ; + font-family : verdana, helvetica, sans-serif +} +TD.leftpanel { + font-size: 14px ; + font-family: verdana, helvetica, sans-serif ; + vertical-align: top ; + width: 150px; + padding: 15px; + background-color: #88aaaa; +} +TD.mainpanel { + font-size : 12pt ; + font-family : helvetica, arial, verdana, sans-serif ; + vertical-align : top; + padding: 15px; +} +TD.footpanel { + font-size: 12px ; + font-family: verdana, helvetica, sans-serif ; + vertical-align: top ; + text-align: right; + padding: 5px; + background-color: #88aaaa; +} +.navigation { + vertical-align: top; + width: 150px; + padding: 15px; + background-color: #445555; + color: #fffcfc; +} +.navheader { + margin-top: -0.5em; + margin-bottom: 0.5em; + text-align: right; + color: #446644; + font-size: 14px; + font-weight: bold; +} + +SPAN.menu { + text-align : center ; + font-size : 12pt ; + font-family : verdana, helvetica, sans-serif +} + +DIV.merit { + margin : 0.5cm ; + width : 800px +} + +TABLE.meritum { + margin : 0.5cm ; + border : 0 +} +.foot { + margin : 0.5cm ; + width : 800px +} +.head { + margin : 0.5cm ; +} + +CODE { + font-family: "Andale Mono", "Courier New", "Courier", monospace; + background-color: #eef0f3; + white-space: nowrap; +} + +.singlesmall { + font-size: 14px; +} + +.doublesmall { + font-size: 12px; +} + + +DIV.footer { + margin : 0.5cm ; + width : 800px +} +.qa { + margin : 0.5cm ; + font-size : 16px; + font-weight : bold; +} +.ans { + margin : 0.5cm ; + font-weight : normal; +} + +H2.hline { + text-align : center ; + font-family : verdana, helvetica, sans-serif +} + +A.extlinks { + font-size : 11pt ; + font-family : verdana, helvetica, sans-serif ; + font-weight : bold +} + +TT { + font-family: courier,sans-serif; + font-size: 11pt; +} +PRE.programlisting { + font-family: courier,sans-serif; + font-size: 10pt; + background-color:#eef0f3; + border-color: #000000; + border-width: 1px; + border-style: solid; +} +SPAN.conflict { + font-size : small ; + font-family: courier,sans-serif; + color : #DD4444; +} +HR.navig { + color: #446644; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} +A.question { + color: #000000; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} +A.question:hover { + color: #000000; + background-color: #eef0f3; + height: 1px; + margin-top: 1em; + border-top: 0px; /* Mozilla work-around to eliminate "groove" */ +} + diff --git a/vim-latex/doc/latex-suite.txt b/vim-latex/doc/latex-suite.txt new file mode 100644 index 0000000..b55e053 --- /dev/null +++ b/vim-latex/doc/latex-suite.txt @@ -0,0 +1,3460 @@ + Latex-Suite Reference + *latex-suite.txt* + Srinath Avadhanula <srinath AT fastmail DOT fm> + Mikolaj Machowski <mikmach AT wp DOT pl> + + + + Abstract + ======== +Latex-Suite attempts to provide a comprehensive set of tools to view, edit and +compile LaTeX documents in Vim. Together, they provide tools starting from +macros to speed up editing LaTeX documents to functions for forward searching +.dvi documents. Latex-Suite has been possible because of the contributions of +many people. Please see latex-suite-credits [|ls_a_dU|] for a list of people who +have helped. + +Latex-Suite is released under the Vim charityware license. For license and +conditions of use look at |copyright|. Replace all occurrences of ``Vim'' with +``Latex-Suite''. The current copyright holders of Latex-Suite are Srinath +Avadhanula and Mikolaj Machowski. + +Homepage: http://vim-latex.sourceforge.net |ls_u_1| + + + + *latex-suite.txt-toc* +|ls_1| Installation and recommended Settings +|ls_2| Inserting Templates +|ls_3| Latex-Suite Macros + |ls_3_1| Environment Mappings + |ls_3_2| Command Mappings + |ls_3_3| Font Mappings + |ls_3_4| Section Mappings + |ls_3_5| Greek Letter Mappings + |ls_3_6| Auc-Tex Key Bindings + |ls_3_7| Diacritics + |ls_3_8| BibTeX Shortcuts + |ls_3_9| Smart Key Mappings + |ls_3_10| Alt Key Macros + |ls_3_11| Custom Macros + |ls_3_12| Making your own Macros via IMAP() +|ls_4| Package Handling + |ls_4_1| Inserting package commands + |ls_4_2| Actions taken for supported packages + |ls_4_3| Automatic Package detection + |ls_4_4| Writing supporting for a package +|ls_5| Latex Completion + |ls_5_1| Latex-Suite completion example + |ls_5_2| Latex-Suite \ref completion + |ls_5_3| Latex-Suite \cite completion + |ls_5_4| Latex-Suite filename completion + |ls_5_5| Custom command completion +|ls_6| LaTeX Compiling + |ls_6_1| Setting Compilation rules + |ls_6_2| Handling dependencies in compilation + |ls_6_3| Compiling multiple times + |ls_6_4| Customizing the compiler output + |ls_6_5| Compiling parts of a file +|ls_7| Latex Viewing and Searching + |ls_7_1| Setting Viewing rules + |ls_7_2| Forward Searching documents + |ls_7_3| Inverse Searching +|ls_8| Latex Folding + |ls_8_1| Default Folding Scheme in Latex-Suite + |ls_8_2| Customizing what to fold + |ls_8_3| Editing the folding.vim file directly +|ls_9| Multiple file LaTeX projects + |ls_9_1| Latex-Suite project settings + |ls_9_2| Specifying which file to compile +|ls_10| Latex-Suite Commands and Maps + |ls_10_1| Latex-Suite Maps + |ls_10_2| Latex Suite Commands +|ls_11| Customizing Latex-Suite + |ls_11_1| General Settings + |ls_11_2| Place-Holder Customization + |ls_11_3| Macro Customization + |ls_11_4| Smart Key Customization + |ls_11_5| Latex Completion Customization + |ls_11_6| Compiler Customization + |ls_11_7| Viewer Customization + |ls_11_8| Menu Customization + |ls_11_9| Folding Customization + |ls_11_10| Package Handling Customization +|ls_12| Credits + +================================================================================ +Viewing this file + +This file can be viewed with all the sections and subsections folded to ease +navigation. By default, vim does not fold help documents. To create the folds, +press za now. The folds are created via a foldexpr which can be seen in the +last section of this file. + +See |usr_28.txt| for an introduction to folding and |fold-commands| for key +sequences and commands to work with folds. + +================================================================================ +Installation and recommended Settings *ls_1* *ls_a_bc* + *recommended-settings* + + + +If you are reading this, it most probably means that you have already installed +Latex-Suite and the help files. If this is not the case, follow the detailed +instructions on Latex-Suite's download page |ls_u_2|. + +Make sure that you create a few necessary settings in your ~/.vimrc. > + + " REQUIRED. This makes vim invoke Latex-Suite when you open a tex file. + filetype plugin on + + " IMPORTANT: win32 users will need to have 'shellslash' set so that latex + " can be called correctly. + set shellslash + + " IMPORTANT: grep will sometimes skip displaying the file name if you + " search in a singe file. This will confuse Latex-Suite. Set your grep + " program to always generate a file-name. + set grepprg=grep\ -nH\ $* + + " OPTIONAL: This enables automatic indentation as you type. + filetype indent on + + " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to + " 'plaintex' instead of 'tex', which results in vim-latex not being loaded. + " The following changes the default filetype back to 'tex': + let g:tex_flavor='latex' + + + +In addition, the following settings could go in your ~/.vim/ftplugin/tex.vim +file: > + " this is mostly a matter of taste. but LaTeX looks good with just a bit + " of indentation. + set sw=2 + " TIP: if you write your \label's as \label{fig:something}, then if you + " type in \ref{fig: and press <C-n> you will automatically cycle through + " all the figure labels. Very useful! + set iskeyword+=: + + + +================================================================================ +Inserting Templates *ls_2* *ls_a_bd* + *latex-suite-templates* + + + +This functionality is available via the TeX-Suite > Templates menu. This module +provides a way to insert custom templates at the beginning of the current file. + +When Latex-Suite first starts up, it scans the +$VIM/ftplugin/latex-suite/templates/ directory and creates menu items based on +the files found there. When you select a template from this menu, the file will +be read in above the first line of the current file. + +A template file can utilize placeholders for initializing the cursor position +when the template is read in and subsequent movement. In addition, template +files can contain dynamic elements such as the time of creation of a file etc, +by using vim expressions. + +You can place your own templates in the $VIM/ftplugin/latex-suite/templates/ +directory in order for them to be available via the menu. Unless Latex-Suite +releases a template with the same name, these files should not get over-written +when you install a new release over an existing one. + +NOTE: Templates are also accessible for non-gui users with the command + |:TTemplate|. The argument should be name of the corresponding template + file. If the command is called without arguments (preferred usage), then a + list of available templates is displayed and the user is asked to choose + one of them. + + + +================================================================================ +Latex-Suite Macros *ls_3* *ls_a_be* + *latex-macros* + +|ls_3_1| Environment Mappings +|ls_3_2| Command Mappings +|ls_3_3| Font Mappings +|ls_3_4| Section Mappings +|ls_3_5| Greek Letter Mappings +|ls_3_6| Auc-Tex Key Bindings +|ls_3_7| Diacritics +|ls_3_8| BibTeX Shortcuts +|ls_3_9| Smart Key Mappings +|ls_3_10| Alt Key Macros +|ls_3_11| Custom Macros +|ls_3_12| Making your own Macros via IMAP() + + +Latex-Suite ships with a very comprehensive set of insert mode and |visual-mode| +mappings and menu items to typeset most of the LaTeX elements. + +NOTE: These mappings are are not standard mappings in the sense that only the + last character is mapped. See plugin/imaps.vim for further documentation. + For example, in the case of the mapping EFI provided by Latex-Suite you + can press the characters 'E', 'F' and 'I' as slowly as you wish (unlike + the normal imap command where timeout issues are involved). The characters + are visible as you type them (unlike normal imaps) and you can use the + movement or backspace key to correct yourself unlike normal mappings. + + + *place-holder* *ls_a_dV* + *place-holders* *ls_a_eD* +NOTE: Place Holders + ------------- + Almost all macros provided in Latex-Suite implement Stephen Riem's + bracketing system and Gergely Kontra's JumpFunc() for handling + place-holders. This consists of using "place-holders" to mark off + locations where the next relevant editing has to be done. As an example, + when you type EFI in |insert-mode|, you will get the following: > + \begin{figure}[h] + \centerline{\psfig{figure=<+eps file+>}} + \caption{<+caption text+>} + \label{fig:<+label+>} + \end{figure}<++> +< The text <+eps file+> will be selected and you will be left in + |select-mode| so that you can continue typing straight away. After having + typed in the file name, you can press <Ctrl-J> (while still in + insert-mode). This will take you directly to the next "place-holder". i.e, + <+caption text+> will be visually selected with Vim in select mode again + for typing in the caption. This saves on a lot of key presses. + + + *overriding-macros* *ls_a_eE* +NOTE: Over-riding Latex-Suite Macros + ------------------------------ + If you wish to change these macros from their default values, for example, + if you wish to change `w to expand to \omega instead of its default + expansion to \wedge, you should use the IMAP function as described in the + Using IMAP() [|ls_a_bG|] section. + + An important thing to note is that if you wish to over-ride macros created + by Latex-Suite rather than merely create new macros, you should place the + IMAP() calls in a script which gets sourced after the files in + Latex-Suite. A good place typically is as a file-type plugin file in the + ~/.vim/after/ftplugin/ directory. (Use ~/vimfiles if you are using + WINDOWS). For example to over-ride `w to \omega instead of \wedge, place + the following line in (say) ~/.vim/after/ftplugin/tex_macros.vim: > + call IMAP('`w', '\omega', 'tex') +< + + NOTE: It is important to use a file-name which will get sourced on a + FileType event. Therefore you must use a file-name which conforms to + the standards as described in |ftplugin-name|. + + + + *pausing-imaps* *ls_a_eF* +NOTE: Pausing Macro expansion + ----------------------- + If you wish to temporarily suspend the imaps functionality, then you can + set the Imap_FreezeImap to 1. If you set g:Imap_FreezeImap to 1, then it + will be a system-wide setting. Setting b:Imap_FreezeImap will affect only + the current buffer. + + +The following sections describe the various editing macros provided by +Latex-Suite. + + +-------------------------------------------------------------------------------- +Environment Mappings *ls_3_1* *ls_a_bf* + *environment-mappings* + +Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX +environments, i.e, \begin{...} ... \end{...} pairs. + +Inserting Environments *ls_3_1_1* *ls_a_bg* + *inserting-environments* + +Latex-Suite provides the following ways to insert environments + + + +Method 1: Pressing <F5> *ls_3_1_1_1* *ls_a_bh* + *inserting-env-f5* + +If you press <F5> in the insert or normal mode while on an empty line, +Latex-Suite prompts you with a list of environments you might want to insert. +You can either choose one from the list or type in a new environment name. If +you press <F5> on a line which already has a word, then that word is used +instead of prompting. + +See Tex_Env_name [|ls_a_cZ|] for a description of how Latex-Suite uses the word +to form the expansion and how to modify Latex-Suite's behavior. + +The list of environments which Latex-Suite prompts you with (when <F5> is +pressed on an empty line) is formed from the Tex_PromptedEnvironments +[|ls_a_di|] setting. + +In addition to this setting, Latex-Suite also lists environments found in custom +packages as described in the section Package actions. [|ls_a_bL|] + + +Method 2: Using <S-F1>-<S-F4> *ls_3_1_1_2* *ls_a_bi* + *inserting-env-shift-f1* + +The shifted function keys, <S-F1> to <S-F4> can be mapped to insert very +commonly used environments. The environments mapped to each key can be +customized via the g:Tex_HotKeyMappings [|ls_a_dj|] setting. + + +Method 3: Using three letter sequences *ls_3_1_1_3* *ls_a_bj* + *inserting-env-threeletter* + +Environments can also be inserted by pressing a 3 capital letter sequence +starting with an E. The sequence of 3 letters generally tries to follow the +following rules: + + +1. All environment mappings begin with E + +2. If the environment can be broken up into 2 distinct words, such as flushright + (flush + right), then the next 2 letters are the first letters of the 2 + words. Example: > + flushleft (_f_lush + _l_eft) ---> EFL + flushright (_f_lush + _r_ight) ---> EFR + eqnarray (_e_qn + _a_rray) ---> EEA +< If on the other hand, the environment name cannot be broken up into 2 + distinct words, then the next 2 letters are the first 2 letters of the name + of the environment. Example: > + equation (_eq_uation) ---> EEQ +< +Unfortunately there are some environments that cannot be split in two words and +first two letters in name are identical. In this case shortcut is created from +E, first and last letter. Example: > + quote (_q_uot_e_) ---> EQE + quotation (_q_uotatio_n_) ---> EQN +Of course, not every last one of the environments can follow this rule because +of ambiguities. In case of doubt, pull down the Tex-Environments menu. The menu +item should give the hint for the map. + + +Enclosing in Environments *ls_3_1_2* *ls_a_bk* + *enclosing-environments* + +Latex-Suite provides visual-mode mappings which enclose visually selected +portions of text in environments. There are two ways provided to do this. + + + +Method 1: Pressing <F5> *ls_3_1_2_1* *ls_a_bl* + *enclosing-env-f5* + +You can also select a portion of text visually and press <F5> while still in +visual mode. This will prompt you with a list of environments. (This list can be +customized via the g:Tex_PromptedEnvironments [|ls_a_di|] setting). You can +either choose from this list or type in a new environment name. Once the +selection is done, Latex-Suite encloses the visually selected portion in the +chosen environment. + + +Method 2: Using three letter mappings *ls_3_1_2_2* *ls_a_bm* + *enclosing-env-threeletter* + +You can also select text visually and press a sequence of three characters +beginning with , (the single comma character) and the selected text will be +enclosed in the chosen environment. The three letter sequence follows directly +from the three letter sequence used to insert environments as described here +[|ls_a_bj|]. The following example describes the rule used: + +If ECE inserts a \begin{center}...\end{center} environment, then to enclose a +block of selected text in \begin{center}...\end{center}, simply select the text +and press ,ce. The rule simply says that the leading E is converted to , and the +next 2 letters are small case. +Some of the visual mode mappings are sensitive to whether you choose line-wise +or character-wise. For example, if you choose a word and press ,ce, then you get +\centerline{word}, whereas if you press ,ce on a line-wise selection, you get: > + \begin{center} + line + \end{center} + + + +Changing Environments *ls_3_1_3* *ls_a_bn* + *changing-environments* + +Pressing <S-F5> in normal mode detects which environment the cursor is presently +located in and prompts you to replace it with a new one. The innermost +environment is detected. For example, in the following source: > + \begin{eqnarray} + \begin{array}{ccc} + 2 & 3 & 4 + \end{array} + \end{eqnarray} +if you are located in the middle "2 & 3 & 4" line, then pressing <S-F5> will +prompt you to change the array environment, not the eqnarray environment. In +addition, Latex-Suite will also try to change lines within the environment to be +consistent with the new environment. For example, if the original environment +was an eqnarray environment with a \label command, then changing it to an +eqnarray* environment will delete the \label. + +Pressing <F5> in normal mode has the same effect as pressing <F5> in +insert-mode, namely you will be prompted to choose an environment to insert. + +-------------------------------------------------------------------------------- +Command Mappings *ls_3_2* *ls_a_bo* + *latex-command-maps* + +Latex-Suite provides a rich set of mappings to insert, enclose and modify LaTeX +commands. + +Inserting LaTeX commands *ls_3_2_1* *ls_a_bp* + *inserting-commands* + + *ls-imap-f7* *ls_a_dW* + *ls-imap-s-f7* *ls_a_dX* +Pressing <F7> in insert or normal mode while the cursor is touching a word will +insert a command formed from the word touching the cursor. + +For certain common commands, Latex-Suite will expand them to include additional +arguments as needed. For example, frac becomes \frac{<++>}{<++>}<++>. Otherwise, +it will simply change the word under the cursor as follows > + word --> \word{<++>}<++> +You can define custom expansions of commands using the Tex_Com_{name} setting as +described in here [|ls_a_da|]. + +If <F7> is pressed when the cursor is on white-space, then Latex-Suite will +prompt you to choose a command and insert that instead.The list of commands is +constructed from the g:Tex_PromptedCommands [|ls_a_dk|] setting and also from +commands which Latex-Suite finds while scanning custom packages which +Latex-Suite finds. See the Package actions [|ls_a_bL|] section for details on +which files are scanned etc. + + +Enclosing in a command *ls_3_2_2* *ls_a_bq* + *enclosing-commands* + +You can select a portion of text visually and press <F7> while still in visual +mode. This will prompt you with a list of commands. (This list can be customized +via the g:Tex_PromptedCommands [|ls_a_dk|] setting). You can either choose from +this list or type in a new command name. Once the selection is done, Latex-Suite +encloses the visually selected portion in the chosen command. + + +Changing commands *ls_3_2_3* *ls_a_br* + *changing-commands* + + *ls-vmap-f7* *ls_a_dY* +In both insert and normal mode <S-F7> will find out if you are presently within +an environment and then prompt you with a list of commands to change it to. + +-------------------------------------------------------------------------------- +Font Mappings *ls_3_3* *ls_a_bs* *font-maps* + +These mappings insert font descriptions such as: \textsf{<++>}<++> with the +cursor left in place of the first placeholder [|ls_a_eD|] (the <++> characters). + +Mnemonic: +1. first letter is always F (F for font) + +2. next 2 letters are the 2 letters describing the font. + +Example: Typing FEM in insert-mode expands to \emph{<++>}<++>. + +Just like environment mappings, you can visually select an area and press `sf to +have it enclosed in: \textsf{word} or > + {\sffamily + line + } +depending on character-wise or line-wise selection. + +-------------------------------------------------------------------------------- +Section Mappings *ls_3_4* *ls_a_bt* + *section-mappings* + +These maps insert LaTeX sections such as: > + \section{<++>}<++> +etc. Just as in the case of environments and fonts, can be enclosed with a +visual selection. The enclosing is not sensitive to character or line-wise +selection. + +Mnemonic: (make your own!) > + SPA for part + SCH for chapter + SSE for section + SSS for subsection + SS2 for subsubsection + SPG for paragraph + SSP for subparagraph + + +Example: SSE in insert mode inserts > + \section{<++>}<++> +If you select a word or line and press ,se, then you get > + \section{section name} +The menu item in Tex-Environments.Sections have a sub-menu called 'Advanced'. +Choosing an item from this sub-menu asks a couple of questions (whether you want +to include the section in the table of contents, whether there is a shorter name +for the table of contents) and then creates a more intelligent template. + +-------------------------------------------------------------------------------- +Greek Letter Mappings *ls_3_5* *ls_a_bu* + *greek-letter-mappings* + +Lower case + +`a through `z expand to \alpha through \zeta.Upper case: + + > + `D = \Delta + `F = \Phi + `G = \Gamma + `Q = \Theta + `L = \Lambda + `X = \Xi + `Y = \Psi + `S = \Sigma + `U = \Upsilon + `W = \Omega +NOTE: LaTeX does not support upper case for all greek alphabets. + + +Just like other Latex-Suite mappings, these mappings are not created using the +standard imap command. Thus you can type slowly, correct using <BS> etc. + +-------------------------------------------------------------------------------- +Auc-Tex Key Bindings *ls_3_6* *ls_a_bv* + *auc-tex-mappings* + +These are simple 2 key expansions for some very commonly used LaTeX elements: + + > + `^ Expands To \Hat{<++>}<++> + `_ expands to \bar{<++>}<++> + `6 expands to \partial + `8 expands to \infty + `/ expands to \frac{<++>}{<++>}<++> + `% expands to \frac{<++>}{<++>}<++> + `@ expands to \circ + `0 expands to ^\circ + `= expands to \equiv + `\ expands to \setminus + `. expands to \cdot + `* expands to \times + `& expands to \wedge + `- expands to \bigcap + `+ expands to \bigcup + `( expands to \subset + `) expands to \supset + `< expands to \le + `> expands to \ge + `, expands to \nonumber + `~ expands to \tilde{<++>}<++> + `; expands to \dot{<++>}<++> + `: expands to \ddot{<++>}<++> + `2 expands to \sqrt{<++>}<++> + `| expands to \Big| + `I expands to \int_{<++>}^{<++>}<++> +(again, notice the convenient place-holders) + +In addition the visual mode macros are provided: + + > + `( encloses selection in \left( and \right) + `[ encloses selection in \left[ and \right] + `{ encloses selection in \left\{ and \right\} + `$ encloses selection in $$ or \[ \] depending on characterwise or + linewise selection + + +-------------------------------------------------------------------------------- +Diacritics *ls_3_7* *ls_a_bw* + *diacritic-mappings* + +These mappings speed up typing European languages which contain diacritic +characters such as a-umlaut etc. > + +<l> expands to \v{<l>} + =<l> expands to \'{<l>} +where <l> is an alphabet. + + > + +} expands to \"{a} + +: expands to \^{o} +Latex-Suite also ships with smart backspacing [|ls_a_dZ|] functionality which +provides another convenience while editing languages with diacritics. + +NOTE: Diacritics are disabled by default in Latex-Suite because they can + sometimes be a little too intrusive. Moreover, most European users can + nowadays use font encodings which display diacritic characters directly + instead of having to rely on Latex-Suite's method of displaying + diacritics. + + Set the g:Tex_Diacritics [|ls_a_df|] variable to enable diacritics. + + + +-------------------------------------------------------------------------------- +BibTeX Shortcuts *ls_3_8* *ls_a_bx* + *bibtex-bindings* + +Latex-Suite provides an easy way of entering bibliographic entries. Four +insert-mode mappings: BBB, BBL, BBH and BBX are provided, all of which +essentially act in the same manner. When you type any of these in insert-mode, +you will get a prompt asking you to choose a entry type for the bibliographic +entry. + +When you choose an entry type, a bibliographic entry template will be inserted. +For example, if you choose the option 'book' via the map BBB, then the following +template will be inserted: > + @BOOK{<+key+>, + author = {<++>}, + editor = {<++>}, + title = {<++>}, + publisher = {<++>}, + year = {<++>}, + otherinfo = {<++>} + }<++> + + +<+key+> will be highlighted in select-mode and you can type in the bib-key. +After that you can use <Ctrl-J> to navigate to successive locations in the +template and enter new values. + +BBB inserts a template with only the fields mandatorily required for a given +entry type. BBL inserts a template with commonly used extra options. BBH inserts +a template with more options which are not as commonly used. BBX inserts a +template with all the fields which the entry type supports. + +NOTE: Mnemonic + -------- + B for Bibliographic entry, L for Large entry, H for Huge entry, and X + stands for all eXtras. + + + + +Customizing Bib-TeX fields *ls_3_8_1* *ls_a_by* + *adding-bib-options* + +If you wish the BBB command to insert a few additional fields in addition to the +fields it creates, then you will need to define global variables of the form > + g:Bib_{type}_options +in you $VIM/ftplugin/bib.vim file, where {type} is a string like 'article', +'book' etc. This variable should contain one of the letters defined in the +following table + +Character Field Type~ +w address +a author +b booktitle +c chapter +d edition +e editor +h howpublished +i institution +k isbn +j journal +m month +z note +n number +o organization +p pages +q publisher +r school +s series +t title +u type +v volume +y year + +For example, by default, choosing 'article' via BBB inserts the following +template by default > + @ARTICLE{<+key+>, + author = {<++>}, + title = {<++>}, + journal = {<++>}, + year = {<++>}, + otherinfo = {<++>} + }<++> +However, if g:Bib_article_options is defined as 'mnp', then 'article' will +insert the following template > + @ARTICLE{<+key+>, + author = {<++>}, + title = {<++>}, + journal = {<++>}, + year = {<++>}, + month = {<++>}, + number = {<++>}, + pages = {<++>}, + otherinfo = {<++>} + }<++> + + +If you have some other fields you wish to associate with an article which are +not listed above, then you will have to use the Bib_{type}_extrafields option. +This is a newline separated string of complete field names which will be +included in the template. For example, if you define > + let g:Bib_article_extrafields = "crossref\nabstract" +then the article template will include the lines > + crossref = {<++>}, + abstract = {<++>}, + + +NOTE: You will need to define Bib_* settings in your + $VIMRUNTIME/ftplugin/bib.vim file. + + + +-------------------------------------------------------------------------------- +Smart Key Mappings *ls_3_9* *ls_a_bz* + *smart-keys* + +Latex-Suite ships with the following smart keys: + +Smart Backspace +--------------- + *smart-backspace* *ls_a_dZ* +Pressing <BS> in insert mode checks to see whether we are just after something +like \'{a} and if so, deletes all of it. i.e, diacritics are treated as single +characters for backspacing. + +Smart Quotes +------------ +Pressing " (English double quote) will insert `` or '' by making an intelligent +guess about whether we intended to open or close a quote. + +Smart Space +----------- +Latex-Suite maps the <space> key in such a way that $ characters are not broken +across lines. It does this by first setting tw=0 so that Vim will not +automatically break lines and then maps the <space> key to insert newlines +keeping $$'s on the same line. + +Smart Dots +---------- +Pressing ... (3 dots) results in \ldots outside math mode and \cdots in math +mode. + +-------------------------------------------------------------------------------- +Alt Key Macros *ls_3_10* *ls_a_bA* + *altkey-mappings* + +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. + + +NOTE: 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 + [|ls_a_cx|]. + + + + +<Alt-L> *ls_3_10_1* *ls_a_bB* *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 cursor Expansion~ +( \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{<++>}<++>. + + +<Alt-B> *ls_3_10_2* *ls_a_bC* *Alt-B* + +This insert-mode mapping encloses the previous character in \mathbf{}. + + +<Alt-C> *ls_3_10_3* *ls_a_bD* *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{} + + +<Alt-I> *ls_3_10_4* *ls_a_bE* *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: + +Environment Style~ +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 [|ls_a_dl|] variable. + +-------------------------------------------------------------------------------- +Custom Macros *ls_3_11* *ls_a_bF* + *custom-macros-menu* + +This functionality available via the TeX-Suite.Macros menu, provides a way of +inserting customized macros into the current file via the menu. + +When Latex-Suite starts up, it scans the $VIM/ftplugin/latex-suite/macros/ +directory and creates a menu from the files found there. Each file is considered +as a single macro. You can place your own macros in this directory, using +placeholders [|ls_a_eD|] if wanted. + +When you choose a macro from the menu, the corresponding file is read into the +current buffer after the current cursor position. In non-gui mode, you can use +the |TMacro| command instead of choosing from the menu. This command takes the +macro file name as an argument. When called without arguments (preferred usage), +then a list of available macro files is displayed and the user is prompted to +choose one of them). + +There are some other tools provided in this menu, namely: + + +{New} Creates a new (unnamed) buffer in the latex-suite/macros/ directory. + Use the command :TexMacroNew in non-gui mode. +{Edit} Opens up the corresponding macro file for editing. Use |:TexMacroEdit| + in non-gui mode. When you try to edit {macro} not from local directory + Latex-Suite will copy it to your local directory with suffix "-local". + If local copy already exists Latex-Suite prompt for overwriting it. +{Delete} Deletes the corresponding macro. Use the prefixed numbers for fast + navigation of menus. Use |:TexMacroDelete| in non-gui mode. When you + choose to delete {macro} which is not in your local directory + Latex-Suite will refuse to delete it. +{Redraw} Rescans the macros/ directories and refreshes the macros list. + +-------------------------------------------------------------------------------- +Making your own Macros via IMAP() *ls_3_12* *ls_a_bG* + *ls-new-macros* + +If you find the need to create your own macros, then you can use the IMAP() +function provided with Latex-Suite. See [|ls_a_bH|] for a short explanation of +why you might prefer IMAP() over Vim's standard :imap command. An example best +explains the usage: > + :call IMAP('NOM', '\nomenclature{<++>}<++>', 'tex') +This will create a Latex-Suite-style mapping, where if you type NOM in insert +mode, you will get \nomenclature{<++>}<++> with the cursor left in place of the +first <++> characters. See [|ls_a_bI|] for a detailed explanation of the IMAP() +command. + +For maps which are triggered for a given filetype, the IMAP() command above +should be put in the filetype plugin script for that file. For example, for +tex-specific mappings, the IMAP() calls should go in $VIM/ftplugin/tex.vim. For +globally visible maps, you will need to use the following in either your +~/.vimrc or a file in your $VIM/plugin directory. > + augroup MyIMAPs + au! + au VimEnter * call IMAP('Foo', 'foo', '') + augroup END + + + + +Why use IMAP() *ls_3_12_1* *ls_a_bH* + *why-IMAP* + +Using IMAP instead of Vim's built-in :imap command has a couple of advantages: +1. The 'ttimeout' option will generally limit how easily you can type the left + hand side for a normal :imap. if you type the left hand side too slowly, then + the mapping will not be activated. + +2. If you mistype one of the letters of the lhs, then the mapping is deactivated + as soon as you backspace to correct the mistake. + +3. The characters in lhs are shown on top of each other. This is fairly + distracting. This becomes a real annoyance when a lot of characters initiate + mappings. + + +IMAP() syntax *ls_3_12_2* *ls_a_bI* + *ls-imaps-syntax* + +Formally, the syntax which is used for the IMAP function is: > + call IMAP (lhs, rhs, ft [, phs, phe]) + + +Argument Explanation~ +lhs This is the "left-hand-side" of the mapping. When you use IMAP, only + the last character of this word is actually mapped, although the + effect is that the whole word is mapped. + + If you have two mappings which end in a common lhs, then the mapping + with the longer lhs is used. For example, if you do > + call IMAP('BarFoo', 'something', 'tex') + call IMAP('Foo', 'something else', 'tex') +< Then typing BarFoo inserts "something", whereas Foo by itself inserts + "something else". + + Also, the nature of IMAP() makes creating certain combination of + mappings impossible. For example if you have > + call IMAP('foo', 'something', 'tex') + call IMAP('foobar', 'something else', 'tex') +< Then you will never be able to trigger "foobar" because typing "foo" + will immediately insert "something". This is the "cost" which you + incur over the normal :imap command for the convenience of no + 'timeout' problems, the ability to correct lhs etc. + + +rhs The "right-hand-side" of the mapping. This is the expansion you will + get when you type lhs. + + This string can also contain special characters such as <enter> etc. + To do this, you will need to specify the second argument in + double-quotes as follows: > + :call IMAP('EFE', "\\begin{figure}\<CR><++>\\end{figure}<++>", 'tex') +< With this, typing EFE is equivalent to typing in the right-hand side + with all the special characters in insert-mode. This has the advantage + that if you have filetype indentation set up, then the right hand side + will also be indented just as if you had typed it in normally. + + *IMAP_PutTextWithMovement* *ls_a_ea* + You can also set up a Latex-Suite style mapping which calls a custom + function as follows: > + :call IMAP('FOO', "\<C-r>=MyFoonction()\<CR>", 'tex') +< where MyFoonction is a custom function you have written. If + MyFoonction also has to return a string containing <++> characters, + then you will need to use the function IMAP_PutTextWithMovement(). An + example best explains the usage: + + > + call IMAP('FOO', "\<C-r>=AskVimFunc()\<CR>", 'vim') + " Askvimfunc: Asks For Function Name And Sets Up Template + " Description: + function! AskVimFunc() + let name = input('Name of the function : ') + if name == '' + let name = "<+Function Name+>" + end + let islocal = input('Is this function scriptlocal ? [y]/n : ', 'y') + if islocal == 'y' + let sidstr = '<SID>' + else + let sidstr = '' + endif + return IMAP_PutTextWithMovement( + \ "\" ".name.": <+short description+> \<cr>" . + \ "Description: <+long description+>\<cr>" . + \ "\<C-u>function! ".name."(<+arguments+>)<++>\<cr>" . + \ "<+function body+>\<cr>" . + \ "endfunction \" " + \ ) + endfunction +< + + +ft The file type for which this mapping is active. When this string is + left empty, the mapping applies for all file-types. A filetype + specific mapping will always take precedence. + + +phs, phe If you prefer to write the rhs with characters other than <+ and +> to + denote place-holders, you can use the last 2 arguments to specify + which characters in the rhs specify place-holders. By default, these + are <+ and +> respectively. + + Note that the phs and phe arguments do not control what characters + will be displayed for the placeholders when the mapping is actually + triggered. What characters are used to display place-holders when you + trigger an IMAP are controlled by the Imap_PlaceHolderStart + [|ls_a_cV|] and Imap_PlaceHolderEnd [|ls_a_er|] settings. + + + +================================================================================ +Package Handling *ls_4* *ls_a_bJ* + *latex-packages* + +|ls_4_1| Inserting package commands +|ls_4_2| Actions taken for supported packages +|ls_4_3| Automatic Package detection +|ls_4_4| Writing supporting for a package + + +Latex-Suite has a lot of functionality written to ease working with packages. +Packages here refers to files which you include into the LaTeX document using +the \usepackage command. + + +-------------------------------------------------------------------------------- +Inserting package commands *ls_4_1* *ls_a_bK* + *inserting-packages* + +When you first invoke Latex-Suite, it scans the +$VIM/ftplugin/latex-suite/packages directory for package script files and +creates a menu from all the files found there. This menu is created under +TeX-Suite > Packages > Supported. This menu contains a list of packages +"supported" by Latex-Suite. When you choose one of the packages from this menu +(for example the amsmath package), then a line of the form > + \usepackage[<++>]{amsmath}<++> +will be inserted into the current file. + +The \usepackage line can also be inserted in an easy manner in the current file +by pressing <F5> while in the preamble of the current document. This will set up +a prompt from the supported packages and ask you to choose from one of them. If +you do not find the package you want to insert in the list, you can type in a +package-name and it will use that. Pressing <F5> in the preamble on a line +containing a single word will construct a \usepackage line from that word. + +You can also use the TPackage [|ls_a_cD|] to insert the \usepackage line. + +Once you have inserted a \usepackage line, for supported packages, you can use +the Options and Commands menus described in the next section [|ls_a_bL|]. + +-------------------------------------------------------------------------------- +Actions taken for supported packages *ls_4_2* *ls_a_bL* + *package-actions* + +Latex-Suite takes the following actions for packages detected when a file is +loaded, or a new \usepackage line is inserted using one of the methods described +in the previous section [|ls_a_bK|]. + +If you are using the GUI and you have g:Tex_Menus [|ls_a_dI|] set to 1, +Latex-Suite will create the following sub-menus +TeX-Suite > Packages > <package> Options + +TeX-Suite > Packages > <package> Commands + +where <package> is the package you just inserted (or was detected). You can use +these menus to insert commands, environments and options which Latex-Suite +recognizes as belonging to this package. + +NOTE: While inserting an option, you need to position yourself in the + appropriate place in the document, most commonly inside the square braces + in the \usepackage[]{packname} command. Latex-Suite will not navigate to + that location. + + +In addition to creating these sub-menus, Latex-Suite will also scan the +$VIM/ftplugin/latex-suite/dictionaries directory and if a dictionary file +corresponding to the package file is found, then it will add the file to the +'dict' setting in Vim so you can use the <C-X><C-K> command to complete words +from that file. + +For example, the SIUnits package has a custom dictionary. + + *latex-package-scanning* *ls_a_eb* +If a package detected at startup is found by Latex-Suite in the current +directory or in a location specified by the g:Tex_TEXINPUTS [|ls_a_dT|] +variable, Latex-Suite will scan the package for \newenvironment and newcommand +lines and also append any commands and environments found to the list of +commands and environments which you are prompted with when you press <F5> +[|ls_a_bh|] or <F7> [|ls_a_dW|] in insert mode. +In addition, the TeX-Suite > Packages menu also contains the following submenus + +Update +------ +This command is to be invoked with the cursor placed on the package name. If the +corresponding package is found, then a sub-menu with the supported commands and +options is created. + +Update All +---------- +This function reads the preamble of the document for \usepackage lines and if +Latex-Suite supports the detected packages, then sub-menus containing the +package options and commands are created. + + +-------------------------------------------------------------------------------- +Automatic Package detection *ls_4_3* *ls_a_bM* + *automatic-package-detection* + +Whenever Latex-Suite begins editing a new LaTeX file, it scans it for +\usepackage{name} lines, and if a supported package is found, then it will +create sub-menus and add to the 'dict' setting as described above. + +If a master-file [|ls_a_ct|] has been specified, then it will scan that file +instead of the current file. See the section Custom Packages [|ls_a_bN|] to see +which files Latex-Suite will scan in more detail. + +For all the packages detected in this manner, Latex-Suite will take certain +actions as described in the section package support. [|ls_a_bL|]. + + + +Custom Packages *ls_4_3_1* *ls_a_bN* + *custom-packages* + +Often times, the preamble can become too long, and some people prefer to put +most of their personalization in a custom package and include that using a +\usepackage line. Latex-Suite tries to search such customs package for other +\usepackage lines, so that supported packages included in this indirect manner +can also be used to create sub-menus, extend the 'dict' setting etc. The most +obvious place to place such custom packages is in the same directory as the +edited file. In addition, LaTeX also supports placing custom packages in places +pointed to by the $TEXINPUTS environment variable. + +If you use the $TEXINPUTS variable in LaTeX, and you wish Latex-Suite to search +these custom packages for \usepackage lines, then you need to initialize the +g:Tex_TEXINPUTS [|ls_a_dT|] variable. + +The g:Tex_TEXINPUTS variable needs to be set in the same format which Vim uses +for the 'path' setting. This format is explained in detail if you do > + :help file-searching +from within Vim. + +Therefore the value of g:Tex_TEXINPUTS will most probably be different from +$TEXINPUTS which your native LaTeX distribution uses. + +Example: > + let g:Tex_TEXINPUTS = '~/texmf/mypackages/**,./**' +The ** indicates that all directories below the directory ~/texmf/mypackages and +./ are to be scanned for custom packages. + +NOTE: The present directory '.' is always searched. You need not include that in + g:Tex_TEXINPUTS. + + + +-------------------------------------------------------------------------------- +Writing supporting for a package *ls_4_4* *ls_a_bO* + *supporting-packages* + +Supporting a package is easy and consists of writing a vim script with the same +name as the package and placing it in the $VIM/ftplugin/latex-suite/packages +directory. A package script should define two variables as described in the next +two sections. In addition to these two variables, you can also define any +functions, environment definitions etc. in this file. + + + +g:Tex_package_option_<package> *ls_4_4_1* *ls_a_bP* + +This setting is a string containing a comma separated list of options supported +by this package. + +Example: > + g:Tex_package_option_mypack = 'opt1,opt2=,sbr:group1,opt3,opt4' +The = suffix means that the option takes a value. Use sbr:group name to separate +options into sub-menus. All successive options will be clubbed into the group1 +sub-menu till the next sbr: option is encountered. + + +g:Tex_package_<package> *ls_4_4_2* *ls_a_bQ* + + > + + g:TeX_package_<package> = "pre:Command,pre:Command1" + More detailed example is in latex-suite/packages/exmpl file (slightly + outdated). + Here is short summary of prefixes which can be used in package files: + (x - place with cursor, <++> - |placeholder|) + + {env:command} Environment: creates simple environment template + \begin{command} + x + \end{command}<++> + {eno:command} Environment with option: + \begin[x]{command} + <++> + \end{command}<++> + {ens:command[<<option>>]...} Environment special: + \begin[<<option>>]...{command} + <++> + \end{command}<++> + {bra:command} Brackets: + \command{x}<++> + {brd:command} Brackets double: + \command{x}{<++>}<++> + {brs:command[<<option>>]...} Brackets special (as environment special: + \command[<+x+>]{<++>}{<++>}<++> + {nor:command} Normal: + \command<Space + {noo:command} Normal with option: + \command[x]<++> + {nob:command} Normal with option and brackets: + \command[x]{<++>}<++> + {pla:command} Plain: + command<Space + {spe:command} Special: + command <-literal insertion of command + {sep:command} creates separator. Good for aesthetics and usability :) + {sbr:command} Breaks menu into submenus. <command> will be title of submenu. + Can be used also in package variable. + + Command can be also given without prefix:. The result is + \command + + + +================================================================================ +Latex Completion *ls_5* *ls_a_bR* + *latex-completion* + +|ls_5_1| Latex-Suite completion example +|ls_5_2| Latex-Suite \ref completion +|ls_5_3| Latex-Suite \cite completion +|ls_5_4| Latex-Suite filename completion +|ls_5_5| Custom command completion + + +Latex-Suite provides an easy way to insert references to labels and +bibliographic entries and also provide filename arguments to commands such as +\includegraphics. Although the completion capabilities are very diverse, +Latex-Suite only uses a single key (<F9> by default) to do all of it. Pressing +the <F9> key does different things based on where you are located. Latex-Suite +tries to guess what you might be trying to complete at the location where you +pressed <F9>. For example, pressing <F9> when you are within a \ref command will +try to list the \label's in the present directory. Pressing it when you are in a +\cite command will list bibliography keys. Latex-Suite also recognizes commands +which need a file name argument and will put up an explorer window for you to +choose a filename. + + *ls-set-grepprg* *ls_a_eG* +NOTE: Before you start with Latex-Suite's completion function... + ---------------------------------------------------------- + All of Latex-Suite's completion capabilities depend on a external program + being available on your system which can search through a number of files + for a reg-exp pattern. On *nix systems, the pre-installed grep utility is + more than adequate. Most windows systems come with a utility findstr, but + that has proven to be very inadequate (for one, it does not have an option + to force the file name to be displayed when searching through a single + file). Your best bet is to install cygwin |ls_u_3|, but if you think + that's overkill, you can search for |ls_u_4| a windows implementation of + GNU grep. (Latex-Suite testing on windows has been done with cygwin's port + of GNU grep). + + Once you have a grep program installed, you need to set the 'grepprg' + option for vim. Make sure you use a setting which forces the program to + display file names even when you are searching through a single file. For + GNU grep, the syntax is > + set grepprg=grep\ -nH\ $* +< + + + +-------------------------------------------------------------------------------- +Latex-Suite completion example *ls_5_1* *ls_a_bS* + *ls-completion-usage* + +Consider the situation where you are editing a file with two equations labelled +eqn:euler and eqn:einstein. Now you want to insert a reference to one of these +equations. To do this, you type the \ref{eqn:} command and with the cursor +placed after eqn:, press <F9>. This will bring up two new windows beneath the +main window you were working in as shown in the figure below. > + + 8 These are a couple of equations: + 9 +-- 4 lines: eqnarray (eqn:euler) : e^{j\pi} + 1 &=& 0--------------- + 13 +-- 4 lines: equation (eqn:einstein) : E = m c^2--------------------- + 17 + 18 These are a couple of figures: + 19 +-- 7 lines: figure (fig:monkeys) : Monkeys can Type------------------- + 26 +-- 7 lines: figure (fig:shakespeare) : Shakespeare could not type----- + 33 + 34 This is a reference to \ref{eqn:}<++> + 35 + 36 + 37 \end{document} + 38 + ~ + ~ + ~ + newfile.tex 34,32 Bot + newfile.tex|11| \label{eqn:euler} + newfile.tex|15| \label{eqn:einstein} + ~ + [Error List] 1,1 All + 7 + 8 These are a couple of equations: + 9 \begin{eqnarray} + 10 e^{j\pi} + 1 &=& 0 + 11 \label{eqn:euler} + 12 \end{eqnarray} + 13 \begin{equation} + 14 E = m c^2 + 15 \label{eqn:einstein} + 16 \end{equation} + newfile.tex [Preview] 11,3 21% + + + +The first window (shown as [ErrorList] above) is a |cwindow| containing a list +of possible matches for the reference. The cursor will be located in the first +line of this window. The bottom window is a preview-window showing the context +of the \label. Moving around in the [ErrorList] window automatically scrolls the +preview window so as to always keep showing the context of the \label being +viewed in the [ErrorList] window. You can also press J and K in the [ErrorList] +window to scroll the preview window up and down. + +To insert one of the labels, simply position the cursor in the correct line in +the [ErrorList] window and press <enter>. This will immediately close the two +newly opened windows, get back to the correct location in the original file +being edited and insert the label into the \ref command. + +If you notice carefully in the example above, the [ErrorList] window only showed +the matches for the equations and did not list any of the figure labels. This is +because we pressed <F9> after \ref{eqn: instead of simply after \ref{. This +caused Latex-Suite to search only for those labels which started with the string +eqn:. If you had pressed <F9> after a \ref{, you would have been shown matches +from _all_ labels, not just those starting with eqn:. + +Thus prefixing all your labels with eqn:, fig:, tab: etc. depending on what you +are labelling will lead to an easier time completing references. + +-------------------------------------------------------------------------------- +Latex-Suite \ref completion *ls_5_2* *ls_a_bT* + *ls-completion-ref* + +Pressing <F9> when you are within a partially completed \ref command will split +open a window (named __OUTLINE__) which contains a nicely formatted list of all +the \labels found in the present project. The \labels are heirarchically +arranged according to which \section, \subsection etc of the overall document +structure they are present in. For example, when you first press <F9> after +typing \ref{, you should see something like: > + + +-- 54 lines: 2. Kinematics-------------------------------- + +-- 98 lines: 3. Aerodynamics of the MFI thorax------------ + +-- 40 lines: 4. Jump Resonance in Fourbar Mechanisms------ + +-- 28 lines: 5. Design and Fabrication Issues------------- + +Each chapter is |fold|ed away so that you can quickly jump to the correct +section/subsection in which the relevant equation is defined. This makes +inserting references significantly faster for large projects with hundreds of +equations. You can then open some of the folds to see for example: > + + +-- 54 lines: 2. Kinematics-------------------------------- + 3. Aerodynamics of the MFI thorax + 3.1. Aerodynamic modeling of the MFI wing forces + 3.1.1. Geometric Specification + eqn:wingnormal-pos + \nhat = T_z(\theta_2) T_y(\theta_y)T_x(\theta_x)\nhat_0, + eqn:T-1 + T_1(\theta_2) &=& T_z(\theta_2) + +The <Tab> key is mapped in this window to toggle folds so that you can quickly +open/close folds in order to navigate the heirarchy faster. Once you are +positioned on a label, press <Enter>. This closes the __OUTLINE__ window, +returns to the window in which you pressed <F9> and inserts the reference at the +current cursor position. + +NOTE: Filtering labels by prefix + -------------------------- + You can press <F9> after typing part of the \label. In this case, + Latex-Suite only presents \labels which begin with the already filled + characters. You can use this to choose between equations, figures, tables + etc. if you consistently label equations to begin with eqn:, figures to + begin with fig: etc. For example, with this scheme, pressing <F9> after + typing \ref{eqn: will only list equations. + + +NOTE: Latex-Suite works the same way if you press <F9> after any command which + contains the letters ref. Thus you can complete \eqref in exactly the same + manner. + + +NOTE: Requirements + ------------ + This method of preseting the \labels depends on Vim being compiled with + python support. To check if you have this, see the output of the :ver + command. If you see something like +python, you are all set. Failing this, + you will need to have python somewhere in your $PATH. + + + +-------------------------------------------------------------------------------- +Latex-Suite \cite completion *ls_5_3* *ls_a_bU* + *latex-completion-cite* + +Latex-Suite provides an easy way to insert references to bibliographic entries. +Pressing <F9> when the cursor is placed inside a partially completed \cite +command will split open a new window (named __OUTLINE__) which contains a +formatted and syntax highlighted list of all bibtex entries found. For example, +pressing <F9> after typing \ref{ should present you with a window which looks +something like this: > + + Article [dickinson:science:99] + "Wing rotation and aerodynamic basis of insect flight" + M. H. Dickinson and F-O. Lehman and S. P. Sane + In Science, 1999 + + Article [ellington:84:part1] + "The Aerodynamics of Hovering Insect Flight. I. The Quasi-Steady Analysis" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + + Article [ellington:84:part2] + "The Aerodynamics of Hovering Insect Flight. II. Morphological Parameters" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + + + +You can easily jump from one entry to another using the 'n' and 'p' keys (to go +to the next / previous entry respectively). + +You can also filter out a subset of the bibtex entries by pressing 'f' while in +this window. Doing this presents the following prompt: > + + Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message) + [t] title [a] author [b] booktitle + [j] journal [y] year [p] bibtype + (you can also enter the complete field name) + Enter filter criterion [field<space>value]: + +At the prompt, type > + a ellington +Notice that the letter a is an acronym for author according to the prompt above. +Therefore this filter only shows those bibtex entries whose author field +contains the text ellington. You can keep narrowing your selection by repeatedly +filtering the results. If you would like to remove all the filters and see all +entries again, press 'a', which removes all the filters. + +You can also sort the bibtex entries based on a field. To do this, press 's'. +This will present you with a prompt like in the case of the filter and you are +asked to choose a field. In this case, you would type in a single character. +This sorts the entries according to that field. + +NOTE: <F9> will also work in a similar way after any command which contains the + word cite in it. For example, pressing <F9> will also work with \citenum + etc. + + +The following logic is applied to find out which bibliographic entries are +included in the completion. + + +1. Firstly, if the present file has a master-file [|ls_a_ct|] defined for it, + then Latex-Suite will perform the following steps on that file instead of on + the current file. + +2. First, the file is scanned for a \bibliography command. To explain better, + assume that a command > + \bibliography{file1,file2} +< is found in the present file. For each bibliography file, say file1, + Latex-Suite first tries to see if a .bib file, file1.bib can be found. If so, + it will scan it for bib-keys of the form @BOOK{ etc., and add these searches + to the completion list. If a .bib file cannot be found, then it will try to + see if file1.bbl can be found. If so, Latex-Suite will search it for bib-keys + of the form \bibitem and add these to the completion list. + + You can set the location where Latex-Suite will search for .bib and .bbl + files using the |Tex_BIBINPUTS| [|ls_a_dr|] variable. + +3. If a \bibliography command is not found, then Latex-Suite tries to scan the + present file for a \begin{thebibliography} environment. If found, Latex-Suite + searches the present file for bib-keys of the form \bibitem. + +4. Finally, it will try to see if this file includes other files via the \input + command. For each such file found, Latex-Suite will repeat the previous two + steps stopping at the first file which has either a \bibliography command or + a thebibliography environment. + + +Caching the \cite completion results *ls_5_3_1* *ls_a_bV* + *cite-search-caching* + + *TClearCiteHist* *ls_a_ec* +Often times, the editing cycle proceeds by first laying out a comprehensive +bibliography and then completing all the \cite commands in one session. In such +situations, it is inefficient to scan the whole list of bibliography files for +bib-keys each time. Latex-Suite provides a way to cache the results of the cite +completion search using the Tex_RememberCiteSearch [|ls_a_du|] variable. If set, +Latex-Suite will perform the search only the first time <F9> is used. Next time +on, it will reuse the search results. If you wish to redo the search results, +issue the command > + TClearCiteHist +This will redo the completion list next time you use <F9>. + +-------------------------------------------------------------------------------- +Latex-Suite filename completion *ls_5_4* *ls_a_bW* + *ls-filename-completion* + +When you press <F9> at a location where Latex-Suite guesses a filename needs to +be typed, then a new explorer window will open up with the list of files. You +can use this window to change directories etc. Pressing <enter> on a filename in +the explorer window will automatically close the explorer window, return to the +location where you pressed <F9> from and insert the filename into that position. + +Latex-Suite also tries to guess what kinds of files you might not want to insert +and hides those accordingly. For example, if you press <F9> when you are located +at \includegraphics{, then Latex-Suite knows that you will not want to insert +.tex files. Therefore, the explorer window will automatically hide these files. + +As of now, Latex-Suite recognizes the following commands for filename +completion. Along with the commands, this table also lists the files which +Latex-Suite will not show for completing each command. + +command hide pattern~ +\bibliography '^\.,\.[^b]..$' +\include \includeonly '^\.,\.[^t]..$' +\includegraphics \psfig '^\.,\.tex$,\.bib$,\.bbl$,\.zip$,\.gz$' +\input '' + +-------------------------------------------------------------------------------- +Custom command completion *ls_5_5* *ls_a_bX* + *ls-completion-custom* + +Latex-Suite also recognizes certain commonly used LaTeX commands for the <F9> +key. At the moment, the \bibliographystyle, \addtocontents and the +\addcontentsline commands are recognized, although more will be added in the +future. When you press the <F9> after such a command, Latex-Suite will prompt +you with a list of arguments which make sense for the command. + +This functionality is available for commands for which a global variable of the +form g:Tex_completion_{<command>} is defined where <command> is the command +name. This variable is a comma separated list of values which this command +takes. For example, the argument to the \bibliographystyle command is commonly +one of abbr,alpha,plain,unsrt. Therefore, Latex-Suite defines > + let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt' +You can define your own completion variables in a similar manner for commands +which you might use. + +================================================================================ +LaTeX Compiling *ls_6* *ls_a_bY* + *latex-compiling* + +|ls_6_1| Setting Compilation rules +|ls_6_2| Handling dependencies in compilation +|ls_6_3| Compiling multiple times +|ls_6_4| Customizing the compiler output +|ls_6_5| Compiling parts of a file + + +This functionality, available via the TeX-Suite menu, provides various tools to +compile and debug LaTeX files from within Vim. + +If you are using commonly used LaTeX tools, then you should be all set as soon +as you download and install Latex-Suite. In order to compile a LaTeX file, +simply press \ll while editing the file. This runs latex on the current file and +displays the errors in a |quickfix-window| below the file being edited. You can +then scroll through the errors and press <enter> to be taken to the location of +the corresponding error. Along with the errors being listed in the quickfix +window, the corresponding log file is also opened in |preview| mode beneath the +quickfix window. It is scrolled automatically to keep in sync with the error +being viewed in the quickfix window. You will be automatically taken to the +location of the first error/warning unless you set the g:Tex_GotoError +[|ls_a_dD|] variable to 0. + +Latex-Suite also supports compiling LaTeX into formats other than DVI. By +default, Latex-Suite supports PDF and PS formats. In order to choose a format +other than DVI, use the TTarget command or the TeX-Suite > Target Format menu +item. This will ask you to type in the name of the target format you want to +compile to. If a rule has been defined for the format (as described in the next +section [|ls_a_bZ|]), then Latex-Suite will switch to that format. + +Trying to choose a format for which no rule has been defined will result in +Latex-Suite displaying a warning message without taking any action. + +If you are using a multiple file project and need to compile a master file while +editing other files, then Latex-Suite provides a way to specify the file to be +compiled as described in latex-master-file [|ls_a_ct|]. + + +-------------------------------------------------------------------------------- +Setting Compilation rules *ls_6_1* *ls_a_bZ* + *compiler-rules* + +In order to compile LaTeX files into various formats, Latex-Suite needs to know +which external programs to call and in which way they need to be called. This +information is provided to Latex-Suite via a number of "rules". For each format +you want to compile to, you need to specify a rule. A rule is specified by +defining a variable of the form: > + g:Tex_CompileRule_<format> +where <format> is a string like "pdf", "dvi" etc. + +Example: By default, Latex-Suite uses the following rule for compiling LaTeX +documents into DVI. > + g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' + + +Default values are also provided for ps and pdf formats. You might want to +change these rules in texrc according to your local tex environment. + +NOTE: For win32 users user MikTeX, sometimes the latex compiler's output has a + bug where a single number is split across different lines. In this case, + put the included vim-latex file distributed with Latex-Suite. + + + +-------------------------------------------------------------------------------- +Handling dependencies in compilation *ls_6_2* *ls_a_ca* + *compiler-dependency* + +Latex-Suite also handles compiling dependencies automatically via certain rules +which specify the "dependency chain" for each target format. For example, if in +your case, you use > + .tex -> .dvi -> .ps -> .pdf +to generate pdf files from dvi files, then you will need to specify the +following setting in your Latex-Suite configuration (see customizing Latex-Suite +[|ls_a_cP|] for where these settings should go): > + + let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf' + +This is a comma separated string of formats specifying the order in which the +formats to be compiled into should be chosen. With this setting, if you set the +target format to pdf, then the next time you compile via the \ll shortcut, +Latex-Suite will first generate a dvi file, then use that to generate the ps +file and finally create the pdf file from that. + +NOTE: If any of the intermediate formats is listed in the + g:Tex_MultipleCompileFormats setting as described in the section Compiling + multiple times [|ls_a_cb|], then Latex-Suite might make multiple calls to + the compiler to generate the output file of that format. + + +Along with the g:Tex_FormatDependency_{format} setting, you should ofcourse +specify the rule for compiling to each of the formats as described in the +previous section [|ls_a_bZ|]. For example, with the setting above, you could +use: > + + let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' + let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' + let g:Tex_CompileRule_pdf = 'ps2pdf $*.ps' + + +NOTE: By default, Latex-Suite does not specify any compiler dependencies. Each + target format for which a rule has been derived will be compiled + independently. + + + +-------------------------------------------------------------------------------- +Compiling multiple times *ls_6_3* *ls_a_cb* + *compiling-multiple* + +Most LaTeX compilers need to be re-run several times in several commonly +occurring situations in order to get a final camera ready copy. For example, +when \label's change, when new \cite commands are added etc. If the target +format you are compiling to requires multiple compilations, then you will need +to include the format in the g:Tex_MultipleCompileFormats setting. This is a +comma separated string of formats which need multiple compilations to be +generated correctly. + +By default, this setting contains just the dvi format. If you use the pdflatex +compiler to generate pdf files, then you might want to also include pdf into the +above setting. + +For every format included in the g:Tex_MultipleCompileFormats setting described +above, Latex-Suite will use the following logic to generate the file. Note that +although the following description uses latex to refer to the compiler, it could +be some other compiler such as pdflatex for generating pdf output. + +1. If there was a .idx file, then remember its contents. + +2. Run latex. + +3. If the .idx file changed due to the latex compiler, then run makeindex to + redo the .ind file and then remember to rerun latex. + +4. If the .aux file generated by the latex compiler contains a \bibdata line, + then it means that we are using a .bib file. Therefore, run bibtex. + + NOTE: This means that we will always run bibtex whenever we use the + \bibliography command whether or not we actually need to. At this time, + Latex-Suite does not parse the .aux file before and after the latex + compiler to see if we are required to rerun bibtex. + +5. If the .bbl file changes because of this, then remember to rerun latex again. + +6. Also, we check to see if the LaTeX compiler gives certain standard warnings + which notify that we need to compile once again. In this case also, remember + to rerun LaTeX. + +7. If we found we had to rerun latex, then we repeat the steps above but not + running makeindex or bibtex again. + +The LaTeX file is compiled atmost 5 times using this logic. These steps will +ensure that on most platforms/environments, you will get a clean output with all +the cross-references, citations etc correctly labelled and ordered. + +-------------------------------------------------------------------------------- +Customizing the compiler output *ls_6_4* *ls_a_cc* + *compiler-output-customization* + +Most LaTeX compilers produce a very large amount of output during compilation, +most of which is not relevant to debugging type-setting errors. The compiler +plugin provided with Latex-Suite (which is an enhanced version of the standard +compiler plugin maintained by Artem Chuprina), provides a way to filter the +compiler output so that the actual errors/warnings can be presented much more +concisely. + +The compiler plugin is set up by default to function in a "non-verbose", +"ignore-common-warnings" mode, which means that irrelevant lines from the +compiler output will be ignored and some very common warnings are also ignored. +Latex-Suite does this via the global variable g:Tex_IgnoredWarnings [|ls_a_dA|]. +This is a list of patterns, which can be used to filter out (or ignore) some or +the warnings and errors reported by the compiler. See the link above for its +default value. + +Latex-Suite uses the g:Tex_IgnoreLevel [|ls_a_dB|] setting to set a default +ignore level. For example, for the default value of 4, Latex-Suite ignores +warnings and errors matching the first 4 patterns in g:Tex_IgnoredWarnings. + +In addition to setting a default value of the ignore level, Latex-Suite provides +the ability to set the level dynamically, using the TCLevel command. For +example, if you issue the command: > + TCLevel 3 +from within Vim, then the next time you compile the document, Latex-Suite will +ignore warnings and errors which match the first three patterns in +g:Tex_IgnoredWarnings. + +When TCLevel is called with the unquoted string strict as follows: > + TClevel strict +then Latex-Suite switches to a "verbose", "no-lines-ignored" mode which is +useful when you want to make final checks of your document and want to be +careful not to let things slip by. + +See the explanation of the settings g:Tex_IgnoredWarnings [|ls_a_dA|] and +g:Tex_IgnoreLevel [|ls_a_dB|] to find out how to customize the filtering done by +Latex-Suite + +-------------------------------------------------------------------------------- +Compiling parts of a file *ls_6_5* *ls_a_cd* + *part-compiling* + +Latex-Suite also provides a way to compile a fragment of a document. This can be +very useful while debugging a complex equation or one chapter in a book, etc. + +To do this, visually select a portion of the text and press \ll while in visual +mode. The visually selected portion will be saved to a temporary file with the +preamble from the current document prepended. Latex-Suite will then switch focus +to this temporary file and compile it. Continue to debug this file as required +and then replace the portion of the original file with this one. + +Pressing \lv while viewing the temporary file will view the output file +generated from the temporary file, not the original file + +Two commands |TPartComp| and |TPartView| are provided to be able to get this +functionality via the command line. + +From release 1.6 onwards of Latex-Suite, the temporary file created for part +compilation will reside in the same directory as the file from which the +fragment is being created. This ensures that any relative path-names defined in +the fragment will still work. Latex-Suite will attempt to clean the temporary +file(s) created when Vim exits. + +================================================================================ +Latex Viewing and Searching *ls_7* *ls_a_ce* + *latex-viewing* + +|ls_7_1| Setting Viewing rules +|ls_7_2| Forward Searching documents +|ls_7_3| Inverse Searching + + + +-------------------------------------------------------------------------------- +Setting Viewing rules *ls_7_1* *ls_a_cf* + *latex-viewing-rules* + +In order to view the output files created by compiling the source files, you +need to specify which external program Latex-Suite should call. You can specify +the external program using one of two settings Tex_ViewRule_format [|ls_a_dF|] +or Tex_ViewRuleComplete_format [|ls_a_dG|]. By default, Latex-Suite has default +settings for viewing various common output formats via the Tex_ViewRule_format +settings, so that if you are using commonly used programs, you should be all set +to view compiled files from within Vim by simply pressing \lv. + +NOTE: The viewing function also takes the *.latexmain [|ls_a_ct|] file into + account to decide which file to show. + + +If pressing \lv does not work, then it most probably has to do with incorrect +settings of the g:Tex_ViewRule_<format> [|ls_a_dF|] where <format> is the format +you are attempting to view. See the link above for how to set this according to +your system. + +NOTE: On Windows and OS/X, you can leave the view rule empty to open the + document with the default viewer on your system. On Linux/UNIX systems, + you can use the xdg-open command to open the document with the default + viewer. + + +In addition to viewing the files, Latex-Suite also supports forward and inverse +searching for certain common tools for viewing documents. See the next few +sections for details on forward and inverse searching, including an overview of +viewers. + +-------------------------------------------------------------------------------- +Forward Searching documents *ls_7_2* *ls_a_cg* + *forward-searching* + +Forward searching refers to making a viewer display a given document at a given +location from within Vim. At present, these viewers are known to support forward +searching, but viewers that are not listed here may work, too:Viewer OS Supported documents Comment~ +Skim |ls_u_5| Apple / OS X Tiger PDF Supports also + inverse searching +PDFView |ls_u_6| Apple / OS X PDF No longer in + development, + supports also + inverse searching +TeXniscope |ls_u_7| Apple PDF, DVI +YAP |ls_u_8| Windows DVI, PS ships with MikTex +Sumatra PDF |ls_u_9| Windows PDF +kdvi |ls_u_10| Linux/UNIX DVI +okular |ls_u_11| Linux/UNIX DVI, PDF, PS and Included in KDE 4 + many more +xdvi |ls_u_12| Linux/UNIX DVI +xdvik |ls_u_13| Linux/UNIX DVI + +Pressing \ls from within Vim should make the viewer display the portion of the +document where your cursor is placed.NOTE: OS/X users need to set the g:Tex_TreatMacViewerAsUNIX flag to 1 and + provide a UNIX-like viewrule, that expects as arguments the document, the + linenumber and the sourcefile in this order. + + + + *enabling-searching* *ls_a_ed* +NOTE: Enabling Forward and Inverse Searching + -------------------------------------- + Most DVI viewers need "source-special" information in order to do forward + (and inverse) searching. This information is embedded in the dvi file if + the LaTeX source is compiled with the --src-specials option. By default, + Latex-Suite does not supply this argument to the compiler. See the section + on to find out how this option can be set. + + For pdf viewers you need to use the pdfsync |ls_u_14| package in your + LaTeX document. + + + +-------------------------------------------------------------------------------- +Inverse Searching *ls_7_3* *ls_a_ch* + *inverse-searching* + +Inverse searching refers to the viewer telling Vim to display the LaTeX source +file at a given location when you double-click in the viewer window. + +You will need to enable searching [|ls_a_ed|] in order to use this +functionality. + +You will also need to specify certain settings to the DVI viewer conveying the +syntax which it needs to use to tell Vim how to display the source file. In YAP, +you can set this option in View > Options > Inverse Search. The Command Line +field needs to be set as follows: > + "C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f" +The command :RemoteOpen is supplied when you install Latex-Suite. + +On *nix machines, Latex-Suite attempts to call the DVI viewer in such a way that +it already knows how to communicate with Vim. If this does not seem to be +working, you can use the RemoteOpen command described above. + +================================================================================ +Latex Folding *ls_8* *ls_a_ci* + *latex-folding* + +|ls_8_1| Default Folding Scheme in Latex-Suite +|ls_8_2| Customizing what to fold +|ls_8_3| Editing the folding.vim file directly + + +Latex-Suite ships with the plugin SyntaxFolds.vim which is a plugin for creating +"fake" syntax folds on the fly. The fold method is actually manual but the +folding is based on LaTeX syntax. This offers a speed increase over regular +syntax folding. Ofcourse it has the disadvantage that the folds are not dynamic, +i.e newly created syntax items are not automatically folded up. (This is a +compromise between speed and convenience). + +When you open up a LaTeX file, all the portions will be automatically folded up. +However, no new folds will be created until you press <F6> or \rf. (rf stands +for "refresh folds"). + +The fold-text is set to the first line of the folded text unless the fold is a +table, figure etc. (an environment). In this case, if a \caption and/or a label +is found in the folded region, then those are used to make a more meaningful +fold-text, otherwise the second line of the environment is displayed along with +the name of the environment. In other words, the following > + \begin{figure}[h] + \centerline{\psfig{figure=slidercrank.eps,height=6cm}} + \caption{The Slider Crank Mechanism.} + \label{fig:slidercrank} + \end{figure} + % a LaTeX comment. + \begin{eqnarray} + \sin(\pi) = 0 + \end{eqnarray} + + +will be shown as: > + +--- 5 lines: figure (fig:slidercrank) : The Slider Crank Mechanism. ----- + % a LaTeX comment. + +--- 3 lines: eqnarray () : \sin(\pi) = 0 -------------------------------- + + + +-------------------------------------------------------------------------------- +Default Folding Scheme in Latex-Suite *ls_8_1* *ls_a_cj* + *default-folding* + +By default Latex-Suite creates folds in the following manner: + + > + \chapter + \section + %%fakesection + \subsection + \subsubsection + \item + \equation + \eqnarray + \figure + \table + \footnote +The indentation shows the "nestedness" of the folding scheme. See the next +section [|ls_a_ck|] to see how you can change this scheme. + +-------------------------------------------------------------------------------- +Customizing what to fold *ls_8_2* *ls_a_ck* + *customizing-what-to-fold* + +From version 1.6 onwards, the folding in Latex-Suite can be controlled to a +large extent via a number of global variables. + + + +Tex_FoldedSections *ls_8_2_1* *ls_a_cl* + *Tex_FoldedSections* + +This entry defines which sections will be folded. This setting is a comma +separated list of section names. The default value is: > + part,chapter,section,%%fakesection, + subsection,subsubsection,paragraph +Each of the entries in the list will fold up a section of the corresponding +name. The %%fakesection section is provided as a means for the user to group +lines into "fake" sections. A %%fakesection is assumed to start on a line which +begins with the string %%fakesection and continue till the start of the next +\section, \subsection or any other section. + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedEnvironments *ls_8_2_2* *ls_a_cm* + *Tex_FoldedEnvironments* + +This entry defines which environments will be folded. It is a comma separated +string of words each of which defines a single environment. The default setting +is > + verbatim,comment,eq,gather, + align,figure,table,thebibliography, + keywords,abstract,titlepage +The words need not be standard Latex environments. You can add any word you +like. Also, each word will fold up all environments whose name begins with that +word. For example, in the setting above, the word "eq" folds up the +\begin{equation}, \begin{eqnarray}, \begin{eqnarray*} environments. To avoid +this, you can replace the word "eq" with "eq}". + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedCommands *ls_8_2_3* *ls_a_cn* + *Tex_FoldedCommands* + +This entry defines which commands will be folded. It is a comma separated string +of words each of which defines a single command. The default setting is empty, +i.e no commands are folded. The words need not be standard Latex commands. You +can use whatever words you like. Each word will fold all commands whose name +begins with that word as in the case of the Tex_FoldedEnvironments [|ls_a_cm|] +variable. + +NOTE: It is very difficult to fold commands reliably because it is very + difficult to create a regexp which will match a line containing unmatched + parentheses (or curly brackets), but will not match a line containing + matched parentheses. + + Just to make things safer, only lines which start a command but do not + contain additional curly braces after the command has started are folded. + In other words, if you wanted to fold the the command "mycommand", then + the lines > + \mycommand{This is a line + and some more text on the next line + } +< will be folded, but the lines > + \mycommand{This is a \textbf{line} + and some more text + } +< will not be folded. This is a bug which is very difficult to fix. + + +See also advanced fold settings [|ls_a_cp|]. + + +Tex_FoldedMisc *ls_8_2_4* *ls_a_co* + *Tex_FoldedMisc* + +This entry defines fold syntax for certain items which do not naturally fit into +the section, environment of command lists. It is a comma separated list of +words. The default value is: > + item,preamble,<<< +NOTE: Unlike the other Tex_FoldedXXXX variables, the words in this setting are + limited to take values from the following list: + + Value Meaning~ + comments Folds up contiguous blocks of comments + item Folds up the \items within list environments + preamble Folds up the preamble of a document. (The part between the + \documentclass command and the \begin{document} environment) + <<< Folds defined manually by the user using the <<< and >>> strings + as fold-markers. + + Any other words in the Tex_FoldedMisc setting are silently ignored. + + + +See also advanced fold settings [|ls_a_cp|]. + + +Advanced Fold setting details *ls_8_2_5* *ls_a_cp* + *fold-setting-advanced* + +The order of the words in the Tex_FoldedXXXX variables is _important_. The order +defines the order in which the folds are nested. For example, the value +"subsection,section" for the Tex_FoldedSections variable will not fold any +subsections at all. This is because the folds are created in the _reverse_ order +in which they occur in the Tex_FoldedSections setting and also, once a fold is +created, the interior of the fold is not examined for creating additional folds. +In the above case, this means that a \section is folded first and then its +interior is not examined further. The correct value should have been +"section,subsection" + + *fold-setting-adding* *ls_a_ee* +Each of the fold setting variables Tex_FoldedSections, Tex_FoldedEnvironments +etc., as explained previously is a comma separated string of variables. However, +to make it easier to _add_ to the default settings without having to repeat the +whole default setting again, Latex-Suite uses the following logic in forming the +complete setting string from the Tex_FoldedXXXX variables. If the variable +starts with a comma, then Tex_FoldedXXXX is added to the end of the default +string rather than replacing it. Similarly, if it ends with a comma, then it +will be prepended to the beginning of the default setting rather than replacing +it. + +For example, if Tex_FoldedEnvironments is set to the string "myenv", then only +an environment of the form \begin{myenv} will be folded. However, if the +Tex_FoldedEnvironments setting is ",myenv", then the \begin{myenv} environment +will be folded after all other environments in the default setting have been +folded. On the other hand if Tex_FoldedEnvironments is of the form "myenv,", the +\begin{myenv} environment will be folded before the rest of the environments in +the default setting. + +-------------------------------------------------------------------------------- +Editing the folding.vim file directly *ls_8_3* *ls_a_cq* + *editing-folding* + +If you are using version 1.5 of Latex-Suite or older, you will need to directly +edit the $VIM/ftplugin/latex-suite/folding.vim file if you wish to modify the +folding scheme. You will need to modify the function MakeTexFolds() defined in +that file to modify the fold syntax. MakeTexFolds makes a number of calls to +AddSyntaxFoldItem. Each such call defines a new "fold item". The order in which +these calls are made defines how the folds are nested. For example, if you +desire an figure environment to be nested within a section, then you should +define the fold for the figure first. The syntax of AddSyntaxFoldItem is as +follows: > + AddSyntaxFoldItem(startpat, endpat, startoff, endoff [, startskip, endskip]) +If the last two arguments are omitted, then they are assumed to default to the +empty strings ''. The explanation for each argument is as follows: + +Argument Explanation~ +startpat a line matching this pattern defines the beginning of a fold. +endpat a line matching this pattern defines the end of a fold. +startoff this is the offset from the starting line at which folding will + actually start +endoff like startoff, but gives the offset of the actual fold end from the + line satisfying endpat. startoff and endoff are necessary when the + folding region does not have a specific end pattern corresponding to + a start pattern. for example in LaTeX, \section{Section Name} defines + the beginning of a section, but there is no command which + specifically ends a section. Thus a \section is assumed to end 1 line + _before_ another section starts. +startskip A Pattern Which Defines The Beginning Of A "Skipped" Region. + + For example, suppose we define a \itemize fold as follows: > + = '^\s*\\item', + = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + = 0, + = -1 +< + + This defines a fold which starts with a line beginning with an \item + and ending one line before a line beginning with an \item or + \end{enumerate} etc. + + Then, as long as \item's are not nested things are fine. However, + once items begin to nest, the fold started by one \item can end + because of an \item in an \itemize environment within this \item. + i.e, the following can happen: > + \begin{itemize} + \item Some text <------- fold will start here + This item will contain a nested item + \begin{itemize} <----- fold will end here because next line contains \item... + \item Hello + \end{itemize} <----- ... instead of here. + \item Next item of the parent itemize + \end{itemize} +< + + Therefore, in order to completely define a folding item which allows + nesting, we need to also define a "skip" pattern. startskip and end + skip do that. Leave '' when there is no nesting. +endskip the pattern which defines the end of the "skip" pattern for nested + folds. + +NOTE: Example 1 + --------- + A syntax fold region for the latex section is defined with the following + arguments to AddSyntaxFoldItem: > + startpat = "\\section{" + endpat = "\\section{" + startoff = 0 + endoff = -1 + startskip = '' + endskip = '' +< Note that the start and end patterns are thus the same and endoff has a + negative value to capture the effect of a section ending one line before + the next starts. + + +NOTE: Example 2 + --------- + A syntax fold region for the \itemize environment is: > + startpat = '^\s*\\item', + endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + startoff = 0, + endoff = -1, + startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', + endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' +< Note the use of startskip and endskip to allow nesting. + + + +================================================================================ +Multiple file LaTeX projects *ls_9* *ls_a_cr* + *latex-project* + +|ls_9_1| Latex-Suite project settings +|ls_9_2| Specifying which file to compile + + + *latex-project-example* *ls_a_ef* +Many LaTeX projects contain multiple source files which are \included from a +master file. A typical example of this situation is a directory layout such as +the following + + > + thesis/ + main.tex + abstract.tex + intro/ + intro.tex + figures/ + fig1.eps + fig2.eps + chapter1/ + chap1.tex + figures/ + fig1.eps + conclusion/ + conclusion.tex + figures/ + + +In the above case, main.tex will typically look like + + > + % file: main.tex + \documentclass{report} + \begin{document} + + \input{abstract.tex} + \input{intro/intro.tex} + \input{chapter1/chap1.tex} + \input{conclusion/conclusion.tex} + + \end{document} + + + *latex-master-file-specification* *ls_a_eg* +In such situations, you will need to convey to Latex-Suite that main.tex is the +main file which \inputs the other files. This is done by creating an empty file +called main.tex.latexmain in the same directory in which main.tex resides. This +file is called the _master file_ in this manual. See Tex_MainFileExpression +[|ls_a_eh|] for an alternative way of specifying the master file. + +NOTE: Here main.tex.latexmain is (obviously) a different file from main.tex + itself. main.tex need not be renamed. This ofcourse restricts each + directory to have a single master file. + + +Each time Latex-Suite opens a new LaTeX file, it will try to see if it is part +of a multiple file project by searching upwards (to the root of the file-system) +from the current file's directory to see if it finds a file of the form +*.latexmain. If such a file is found, then it is considered that the current +file is part of a larger project. The name of the LaTeX master file is inferred +directly from the first part of the *.latexmain file as described in the example +above. + + +-------------------------------------------------------------------------------- +Latex-Suite project settings *ls_9_1* *ls_a_cs* + *latex-project-settings* + +If a master file [|ls_a_ct|] is found, then Latex-Suite :sources the file. Thus +this file needs to contain valid Vim commands. This file is typically used to +store project specific settings. + +Some typical per-project settings which are best put in the master file are +Tex_ProjectSourceFiles [|ls_a_dt|] + +-------------------------------------------------------------------------------- +Specifying which file to compile *ls_9_2* *ls_a_ct* + *latex-master-file* + +In the example described previously [|ls_a_ef|], if you are editing +intro/intro.tex and press \ll, then you still want Latex-Suite to compile +main.tex, because intro/intro.tex is merely a fragment which is \input'ed into +main.tex. If the master file is already specified using the *.latexmain +convention described previously [|ls_a_ef|], then Latex-Suite will automatically +compile the master file when you are editing any of its \input'ed fragments. +Thus pressing \ll while editing intro/intro.tex will compile main.tex. + + *Tex_MainFileExpression* *ls_a_eh* +If you wish to use some different logic to specify the main file name, you can +specify a custom expression via the Tex_MainFileExpression variable. This is a +string containing a valid vim expression. In addition, you can use a variable +modifier which is in the format used for |filename-modifiers|, for example, +':p:h'. You should utilize this variable to modify the filename of the main +file. > + let g:Tex_MainFileExpression = 'MainFile(modifier)' + function! MainFile(fmod) + if glob('*.latexmain') != '' + return fnamemodify(glob('*.latexmain'), a:fmod) + else + return '' + endif + endif + + +================================================================================ +Latex-Suite Commands and Maps *ls_10* *ls_a_cu* + *latex-suite-commands-maps* + +|ls_10_1| Latex-Suite Maps +|ls_10_2| Latex Suite Commands + + +This section describes the maps and commands used in Latex-Suite. It also +describes a way to change the map sequences according to your preference. + + +-------------------------------------------------------------------------------- +Latex-Suite Maps *ls_10_1* *ls_a_cv* + *latex-suite-maps* + + *remapping-latex-suite-keys* *ls_a_ei* +Most of the mappings used in Latex-Suite can be mapped to a different key +combination to suit your particular needs. An example best explains the +procedure for doing this. Suppose you want to remap the <C-j> key which +Latex-Suite (actually imaps.vim) uses to jump to the next placeholder. To do +this, you first need to find out which <Plug> mapping <C-j> is derived from. You +will need to look at the relevant section of this manual to do this. For +example, the section IMAP mappings [|ls_a_cw|] has the information that the +<C-j> key is derived from <Plug>IMAP_JumpForward. Therefore to remap the <C-j> +key to say <C-space>, you will need to put a statement like the following in +your ~/.vimrc. > + imap <C-space> <Plug>IMAP_JumpForward + + +NOTE: To change the IMAP mappings which affect jumping between placeholders, the + map statement above has to be placed in your ~/.vimrc. For other mappings + you can place the map statement in your $VIM/ftplugin/tex.vim file. The + reason for this is that the <C-j> maps are created in plugin/imaps.vim, + which is sourced as soon as Vim starts before sourcing any ftplugin files. + + + + +IMAP mappings *ls_10_1_1* *ls_a_cw* + *customize-imap-maps* + +These mappings are utilized for jumping between placeholders as described here +[|ls_a_eD|]. See the parent section [|ls_a_cv|] to find out how to use this +information to change the default maps. + + *Plug_IMAP_JumpForward* *ls_a_ej* + *Plug_IMAP_JumpBack* *ls_a_ek* + *Plug_IMAP_DeleteAndJumpForward* *ls_a_el* + *Plug_IMAP_DeleteAndJumBack* *ls_a_em* +Plug map Default Key~ +<Plug>IMAP_JumpForward <C-j> +<Plug>IMAP_JumpBack (none) +<Plug>IMAP_DeleteAndJumpForward (none) +<Plug>IMAP_DeleteAndJumpBack (none) + +<Plug>IMAP_JumpForward takes you to the location of the next place-holder +[|ls_a_eD|]. + +<Plug>IMAP_JumpBack takes you to the previous place-holder [|ls_a_eD|]. + +<Plug>IMAP_DeleteAndJumpForward deletes the presently selected place-holder and +jumps to the next place-holder irrespective of whether the present placeholder +is empty or not and ignoring the value of place-holder settings like +g:Imap_DeleteEmptyPlaceHolders [|ls_a_cW|] and g:Imap_StickyPlaceHolders +[|ls_a_cX|] + +<Plug>IMAP_DeleteAndJumpBack deletes the presently selected place-holder and +jumps to the previous place-holder irrespective of whether the present +placeholder is empty or not and ignoring the value of place-holder settings like +g:Imap_DeleteEmptyPlaceHolders [|ls_a_cW|] and g:Imap_StickyPlaceHolders +[|ls_a_cX|] + + +Alt-Key mappings *ls_10_1_2* *ls_a_cx* + *customize-alt-key-maps* + +These mappings are are described in the section Alt key macros [|ls_a_bA|]. See +the parent section [|ls_a_ei|] to see how to use the following information to +remap keys. + + *Plug_Tex_MathBF* *ls_a_en* + *Plug_Tex_MathCal* *ls_a_eo* + *Plug_Tex_LeftRight* *ls_a_ep* + *Plug_Tex_InsertItemOnThisLine* *ls_a_eq* +Plug Mapping Default Key~ +<Plug>Tex_MathBF <Alt-B> +<Plug>Tex_MathCal <Alt-C> +<Plug>Tex_LeftRight <Alt-L> +<Plug>Tex_InsertItemOnThisLine <Alt-I> + +-------------------------------------------------------------------------------- +Latex Suite Commands *ls_10_2* *ls_a_cy* + *latex-suite-commands* + + + +:TMacro [{macro}] *ls_10_2_1* *ls_a_cz* *TMacro* + +When used without any arguments lists all available macros defined in runtime +ftplugin/latex-suite/macros/ directories and prompts you to choose one of them. +With one argument |:read| this macro under cursor position. With more than one +argument it will not work :) In Vim >= 6.2 works completion of names of macros +(see 'wildmenu', 'wildmode' for more about command-line completion). + + +:TMacroEdit [{macro}] *ls_10_2_2* *ls_a_cA* + *TMacroEdit* + +Splits window for editing {macro}. When used without any arguments lists all +available macros defined in runtime ftplugin/latex-suite/macros/ directories and +prompt you to choose one of them. When you try to edit {macro} not from local +directory Latex-Suite will copy it to your local directory with suffix "-local". +If local copy already exists Latex-Suite prompt for overwriting it. In Vim >= +6.2 works completion of names of macros (see 'wildmenu', 'wildmode' for more +about command-line completion). + + +:TMacroNew *ls_10_2_3* *ls_a_cB* + *TMacroNew* + +Splits window to write new macro. Directory in new buffer is locally changed to +Latex-Suite/macros/. + + +:TMacroDelete [{macro}] *ls_10_2_4* *ls_a_cC* + *TMacroDelete* + +Delets {macro} from your local ftplugin/latex-suite/macros/ directory. When used +without any arguments lists all available macros defined in Latex-Suite/macros/ +directory and prompt you to choose one of them. When you choose to delete +{macro} which is not in your local directory Latex-Suite will refuse to delete +it. In Vim >= 6.2 works completion of names of macros (see 'wildmenu', +'wildmode' for more about command-line completion) + + +:TPackage [{package, ...}] *ls_10_2_5* *ls_a_cD* + *TPackage* + +When used without any arguments lists name of the packages for which support is +available. If you are using Vim GUI and have Tex_Menus set to 1, then it will +list all files found in the $VIM/ftplugin/latex-suite/packages directory. +Otherwise, Latex-Suite will list files found in the +$VIM/ftplugin/latex-suite/dictionaries directory. Choosing a file from the list +will insert a > + \usepackage[<++>]{<packname>} +line into the buffer at the current cursor location. For Vim 6.2 and above, you +can use command-line completion to choose a package file. You can also call +TPackage with one or more package names separated with spaces in which case, +Latex-Suite will insert \usepackage lines for each of them in turn. + +After inserting the \usepackage line(s), Latex-Suite will support it (them) in +various ways as described in the section Actions taken for supported packages +[|ls_a_bL|]. + + +:TPackageUpdate *ls_10_2_6* *ls_a_cE* + *TPackageUpdate* + +This command `reads' name of package under cursor and turns on possible support. + + +:TPackageUpdateAll *ls_10_2_7* *ls_a_cF* + *TPackageUpdateAll* + +After issuing this command latexSuite scans the file in looking for not declared +packages, removing not needed entries from Packages menu and turning off not +necessary packages' dictionaries. + + +:TTemplate [{template}] *ls_10_2_8* *ls_a_cG* + *TTemplate* + +When used without any arguments lists all available templates from +latex-suite/templates/ directory and prompts to choose one of them. With one +argument :0|read| {template} file. With more than one argument it will not work +:) In Vim >= 6.2 works completion of names of macros (see 'wildmenu', 'wildmode' +for more about command-line completion) + + +:TSection [{argument}] *ls_10_2_9* *ls_a_cH* + *TSection* + +Used without any arguments inserts last section type (|latex-sectioning|). +Accepts arguments: n> inserts section name in <n> logical level. Levels are: +0 part +1 chapter +2 section +3 subsection +4 subsubsection +5 paragraph +6 subparagraph + + ++<n> inserts section name <n> logical levels above the last used comand +-<n> inserts section name <n> logical levels below the last used comand ++ inserts section name one logical level below the last used command (equal + to +1). +++ inserts section name two logical levels below the last used command (equal + to +2). +- inserts section name one logical level over the last used command (equal + to -1). +-- inserts section name two logical levels over the last used command (equal + to -2). + + + +Command accepts also latexSuite mappings (|latex-macros|) without preceding S +and in lowercase: > + :TSection pa +will result in \part{}. It is possible to use full names of sections: :TSection +part + + +:TSectionAdvanced *ls_10_2_10* *ls_a_cI* + *TSectionAdvanced* + +Accepts the same arguments as |TSection| but leads to a couple of questions +(whether you want to include the section in the table of contents, whether there +is a shorter name for the table of contents) and then creates a more intelligent +template. + + +:TLook *ls_10_2_11* *ls_a_cJ* *TLook* + +Accepts one argument. Will look through .tex files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. Note: +TLook uses :grep command and is using 'grepprg'. Its regular expressions can be +different from those of Vim. + + +:TLookBib *ls_10_2_12* *ls_a_cK* + *TLookBib* + +Accepts one argument. Will look through .bib files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. + +NOTE: TLookBib uses :grep command and is using 'grepprg'. Its regular + expressions can be different from those of Vim. + + + + +:TLookAll *ls_10_2_13* *ls_a_cL* + *TLookAll* + +Accepts one argument. Will look through all files in directory of edited file +for argument. It can be regexp. You don't have to enclose argument in "". <cr> +takes you to location. Other keys work as described in |latex-viewer|. Note: +TLook uses :grep command and is using 'grepprg'. Its regular expressions can be +different from those of Vim. + + +:TPartComp *ls_10_2_14* *ls_a_cM* + *TPartComp* + +No argument allowed but accepts range in all formats. Define fragment of +interest with :'a,'b, :/a/,/b/, :'<,'> or :20,30. All other rules of compilation +apply. + + +:TPartView *ls_10_2_15* *ls_a_cN* + *TPartView* + +Show last compiled fragment. All rules of viewing apply but |latex-searching|. + + +:Tshortcuts [{arg}] *ls_10_2_16* *ls_a_cO* + *Tshortcuts* + +Show shortcuts in terminal (not using menu). Without {arg} you will see simple +menu prompting for one of them. Possible arguments: +g General shortcuts +e Environment shortcuts +f Font shortcuts +s Section shortcuts +m Math shortcuts +a All shortcuts + +================================================================================ +Customizing Latex-Suite *ls_11* *ls_a_cP* + *customizing-latex-suite* + +|ls_11_1| General Settings +|ls_11_2| Place-Holder Customization +|ls_11_3| Macro Customization +|ls_11_4| Smart Key Customization +|ls_11_5| Latex Completion Customization +|ls_11_6| Compiler Customization +|ls_11_7| Viewer Customization +|ls_11_8| Menu Customization +|ls_11_9| Folding Customization +|ls_11_10| Package Handling Customization + + +Customizing Latex-Suite is done by defining certain global variables in +$VIM/ftplugin/tex.vim, where $VIM corresponds to ~/.vim for *nix machines and +~/vimfiles for windows machines. This file is not part of the Latex-Suite +distribution. You will need to create this file yourself (or modify it if it +exists) if you need to change any default settings. Since this file is not +included as part of the Latex-Suite distribution, it will not be over-written in +subsequent updates. + +The default settings in Latex-Suite are defined in +$VIM/ftplugin/latex-suite/texrc. Please take a look at this file if you find +this documentation incomplete or confusing. That file is also well documented. + +This chapter describes the various settings which effect Latex-Suite and their +default values. The settings are broken up into sections according to the +behavior which they influence. + + +-------------------------------------------------------------------------------- +General Settings *ls_11_1* *ls_a_cQ* + *ls-general-purpose-settings* + + + +Tex_Debug *ls_11_1_1* *ls_a_cR* + *Tex_Debug* + +Type boolean +Default Value 0 + +If set to 1, then Latex-Suite will create certain global debug statements which +can be printed by doing > + :call Tex_PrintDebug() + + + +Tex_UsePython *ls_11_1_2* *ls_a_cS* + *Tex_UsePython* + +Type boolean +Default Value 1 + +If Latex-Suite detects that your vim is python enabled (using has('python')), +then it tries to use python in certain places to speed things up. If this +misbehaves, you can set this to zero, in which case, Latex-Suite will use +vimscript to accomplish the same. + +-------------------------------------------------------------------------------- +Place-Holder Customization *ls_11_2* *ls_a_cT* + *customizing-place-holders* + +Latex-Suite uses place-holders [|ls_a_eD|] to minimize using the movement keys +while typing. The following settings affect how place-holders are used. + +NOTE: These setting need to be set in your ~/.vimrc, not $VIM/ftplugin/tex.vim + because these settings affect the behavior of imaps.vim, which is a global + plugin, not a file-type plugin. + + + + +g:Imap_UsePlaceHolders *ls_11_2_1* *ls_a_cU* + *Imap_UsePlaceHolders* + + +Type Boolean +Default Value 1 + +Setting this to zero completely disables using place-holders. + + +g:Imap_PlaceHolderStart & g:Imap_PlaceHolderEnd *ls_11_2_2* *ls_a_cV* + *Imap_PlaceHolderStart* + + *Imap_PlaceHolderEnd* *ls_a_er* +Setting Type Value~ +Imap_PlaceHolderStart String '<+' +Imap_PlaceHolderEnd String '+>' + +These settings affect the strings displayed at the beginning and end of the +place-holder string. Set these strings to a value different than a commonly +occurring sequence of characters. + +NOTE: TIP + --- + If you use the latin1 encoding and do not type in french, then you can set + these strings to the \xab and \xbb characters (the french quotation + marks). + + + + +g:Imap_DeleteEmptyPlaceHolders *ls_11_2_3* *ls_a_cW* + *Imap_DeleteEmptyPlaceHolders* + + +Type Boolean +Default Value 1 + +When set to one, non-descriptive or empty place-holders are deleted on pressing +<Ctrl-J>. + + +g:Imap_StickyPlaceHolders *ls_11_2_4* *ls_a_cX* + *Imap_StickyPlaceHolders* + + +Type Boolean +Default Value 1 + +When set to 1, in visual mode, <Ctrl-J> takes you to the next placeholder +without deleting the current placeholder. + +-------------------------------------------------------------------------------- +Macro Customization *ls_11_3* *ls_a_cY* + *customizing-macros* + + + +Tex_Env_name *ls_11_3_1* *ls_a_cZ* + *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() [|ls_a_ea|] function. + +If the name of the environment contains special characters (for example, the +eqnarray* environment), then use the following form: > + let g:Tex_Env_{'eqnarray*'} = + \ "\\begin{eqnarray*}\<CR><++> &=& <++>\<CR>\\end{eqnarray*}<++>" +This will make pressing <F5> after eqnarray* expand to > + \begin{eqnarray*} + <++> &=& <++> + \end{eqnarray*}<++> + + + +Tex_Com_name *ls_11_3_2* *ls_a_da* + *Tex_Com_name* + +If you wish to define new expansions for fast command insertion as described +here [|ls_a_bo|], 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 [|ls_a_cZ|] for additional details on how to create this +setting in various special circumstances. + + +Enabling / disabling macros *ls_11_3_3* *ls_a_db* + *macro-enabling* + +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. + + *Tex_EnvironmentMaps* *ls_a_es* + *Tex_EnvironmentMenus* *ls_a_et* + *Tex_FontMaps* *ls_a_eu* + *Tex_FontMenus* *ls_a_ev* + *Tex_SectionMaps* *ls_a_ew* + *Tex_SectionMenus* *ls_a_ex* +Setting Link to relevant section Default Value~ +g:Tex_EnvironmentMaps Environment Mappings [|ls_a_bf|] 1 +g:Tex_EnvironmentMenus 1 +g:Tex_FontMaps Font Mappings [|ls_a_bs|] 1 +g:Tex_FontMenus 1 +g:Tex_SectionMaps Section Mappings [|ls_a_bt|] 1 +g:Tex_SectionMenus 1 + + +g:Tex_UseMenuWizard *ls_11_3_4* *ls_a_dc* + *Tex_UseMenuWizard* + + +Type Boolean +Default Value 0 + +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 [|ls_a_eD|] +marking off the places where fields need to be filled. + + +g:Imap_FreezeImap *ls_11_3_5* *ls_a_dd* + *Imap_FreezeImap* + +Type boolean +Default Value 0 + +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. + + +g:Tex_CatchVisMapErrors *ls_11_3_6* *ls_a_de* + *Tex_CatchVisMapErrors* + + +Type Boolean +Default Value 1 + +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 and then type some illegal keys. It basically maps +just the g:Tex_Leader character to a function. + + +g:Tex_Diacritics *ls_11_3_7* *ls_a_df* + *Tex_Diacritics* + + +Type Boolean +Default Value 0 + +Whether or not you want to use diacritics [|ls_a_bw|]. + + +g:Tex_Leader *ls_11_3_8* *ls_a_dg* + *Tex_Leader* + + +Type String +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. + + +g:Tex_Leader2 *ls_11_3_9* *ls_a_dh* + *Tex_Leader2* + + +Type String +Default Value ',' + +In order to avoid clashes between the large number of visual mode macros +provided, the visual mode macros for environments [|ls_a_bm|] and sections start +with a character different from g:Tex_Leader. + + +g:Tex_PromptedEnvironments *ls_11_3_10* *ls_a_di* + *Tex_PromptedEnvironments* + + +Type String +Default Value 'eqnarray*,eqnarray,equation,equation*,\[,$$,align,align*' + +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 + + +g:Tex_HotKeyMappings *ls_11_3_11* *ls_a_dj* + *Tex_HotKeyMappings* + + +Type String +Default Value 'eqnarray*,eqnarray,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 eqnarray 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. + + + + +g:Tex_PromptedCommands *ls_11_3_12* *ls_a_dk* + *Tex_PromptedCommands* + + +Type String +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 [|ls_a_bo|]. + +Leaving this string empty will leave the <F7> key unmapped. + + +Tex_ItemStyle_environment *ls_11_3_13* *ls_a_dl* + *Tex_ItemStyle_environment* + +This setting affects the style which Latex-Suite uses to insert an \item when +<Alt-I> is pressed as described here [|ls_a_bE|]. By default Latex-Suite defines +styles for the following environments: + +Environment Style~ +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. + +-------------------------------------------------------------------------------- +Smart Key Customization *ls_11_4* *ls_a_dm* + *customizing-smart-keys* + +These settings affect the smart key functionality as described here [|ls_a_bz|]. + + + +g:Tex_SmartKeyBS *ls_11_4_1* *ls_a_dn* + *Tex_SmartKeyBS* + + +Type Boolean +Default Value 1 + +Whether or not <Backspace> deletes diacritics. + + +g:Tex_SmartKeyQuote *ls_11_4_2* *ls_a_do* + *Tex_SmartKeyQuote* + + +Type Boolean +Default Value 1 + +Whether or not the smart quotes [|ls_a_bz|] functionality is available. + +If enabled, the quote characters can be customized by setting the following +variables: + +Setting Value~ +g:Tex_SmartQuoteOpen "``" +g:Tex_SmartQuoteClose "''" + +Non-English users will want to change these settings to their locale. These +global variables will be ignored if there are buffer-local variables (with the +same name), which may be set in the language specific package files, such as +$VIM/ftplugin/latex-suite/packages/german. + +-------------------------------------------------------------------------------- +Latex Completion Customization *ls_11_5* *ls_a_dp* + *customizing-latex-completion* + +The following settings affect the completion [|ls_a_bR|] functionality in +Latex-Suite. + + + +Window size settings *ls_11_5_1* *ls_a_dq* + *completion-window-preferences* + +These three settings affect the aesthetics of the completion functionality. + + *Tex_ViewerCwindowHeight* *ls_a_ey* + *Tex_ViewerPreviewHeight* *ls_a_ez* + *Tex_ExplorerHeight* *ls_a_eA* + *Tex_ImageDir* *ls_a_eB* +Setting Explanation Default Value~ +g:Tex_ViewerCwindowHeight The height of the cwindow which 5 + displays the list of \labels + etc. +g:Tex_ViewerPreviewHeight The height of the preview window 10 + which shows the context of a + \label etc. +g:Tex_ExplorerHeight The height of the explorer 10 + window which lists the files + from which to choose an image + file. +g:Tex_ImageDir The directory to scan for images '' + + +g:Tex_BIBINPUTS *ls_11_5_2* *ls_a_dr* + *Tex_BIBINPUTS* + + +Type string +Default Value '' + +This string describes the directories which are scanned while trying to search +for .bib and .bbl files. See the cite completion section [|ls_a_bU|] for more +details. + +This string should be set in the syntax accepted by Vim's native 'path' setting. +Do not include the present directory '.'. While searching for bibliography +files, the present directory will be prepended to this variable. + + +Tex_UseSimpleLabelSearch *ls_11_5_3* *ls_a_ds* + *Tex_UseSimpleLabelSearch* + +When set to 1, Latex-Suite searches for \labels in all .tex files in the +directory containing the file being edited when <F9> is pressed. See \ref +completion [|ls_a_bT|] for details. + + +g:Tex_ProjectSourceFiles *ls_11_5_4* *ls_a_dt* + *Tex_ProjectSourceFiles* + + +Type String +Default Value '' + +This setting is meant to be initialized on a per-project basis using the +Latex-Suite master file [|ls_a_ct|] as described in Latex-Suite Project +[|ls_a_cr|] section. It is a list of source files which are used in the project. +If defined, then instead of using the logic described in +Tex_UseSimpleLabelSearch [|ls_a_ds|] to search for files in which to search for +\labels, we simply search for \labels in this list. This significantly reduces +the time it takes to generate the list of possible completions for large +projects. + +The list is specified as a whitespace separated list of filenames relative to +the location of the main file. + + +g:Tex_RememberCiteSearch *ls_11_5_5* *ls_a_du* + *Tex_RememberCiteSearch* + + +Type Boolean +Default Value 0 + +When this variable is non-zero, then Latex-Suite will try to remember results +from the \cite completion as described in this section [|ls_a_bV|]. + +-------------------------------------------------------------------------------- +Compiler Customization *ls_11_6* *ls_a_dv* + *customizing-compiling* + +The following settings affect Latex-Suite's compilation functionality + + + +g:Tex_DefaultTargetFormat *ls_11_6_1* *ls_a_dw* + *Tex_DefaultTargetFormat* + + +Type String +Default Value dvi for windows/*nix and pdf for mac + +Use this setting to choose the default target format. For example, setting this +to pdf makes Latex-Suite compile a pdf file when you press \ll and fire up the +pdf viewer on pressing \lv. Make sure that a rules for compiling and viewing +have been defined for this target format as described here [|ls_a_dx|] and here +[|ls_a_dF|]. + + +g:Tex_CompileRule_<format> *ls_11_6_2* *ls_a_dx* + *Tex_CompileRule_format* + +Here <format> refers to the target format for which this rule is defined. +Latex-Suite supports compiling into dvi, ps and pdf by default. All these rules +are strings defined by default as follows: + + +g:Tex_CompileRule_dvi 'latex -interaction=nonstopmode $*' +g:Tex_CompileRule_ps 'ps2pdf $*' +g:Tex_CompileRule_pdf 'pdflatex -interaction=nonstopmode $*' + +If you desire forward and inverse searching via Latex-Suite, you will need to +change g:Tex_CompileRule_dvi to include -src-specials. However, this has been +known to cause problems with the output file. Therefore, use this with care. + + +g:Tex_FormatDependency_<format> *ls_11_6_3* *ls_a_dy* + +Type string +Default Value '' + +By default, there are no format dependencies defined. Each definition is of the +form above where <format> is a string such as 'dvi' etc. + +The value of each string is a comma separated string such as 'dvi,ps'. See the +Compiler dependency [|ls_a_ca|] section to see how to use/specify this setting + + +g:Tex_MultipleCompileFormats *ls_11_6_4* *ls_a_dz* + *Tex_MultipleCompileFormats* + +Type string +Default Value 'dvi' + +This is a comma separated string of formats for which the compiler needs to be +called multiple times in order to get cross-references, citations etc right. See +the Compiling multiple times [|ls_a_cb|] section for details. + + +g:Tex_IgnoredWarnings *ls_11_6_5* *ls_a_dA* + *Tex_IgnoredWarnings* + + +Type String +Default Value a new-line separated list of patterns as described below + +The default value of this setting is > + \"Underfull\n". + \"Overfull\n". + \"specifier changed to\n". + \"You have requested\n". + \"Missing number, treated as zero.\n". + \"There were undefined references\n" + \"Citation %.%# undefined" +This setting defines a set of patterns which will be filtered out when +displaying the output from the latex compiler. This is to aid in filtering out +very common warnings/errors. + +NOTE: Remember to check the value of g:Tex_IgnoreLevel [|ls_a_dB|] when you + change this setting. For example, if you append a new pattern which you + would like to ignore by default, increase the value of g:Tex_IgnoreLevel. + + + + +g:Tex_IgnoreLevel *ls_11_6_6* *ls_a_dB* + *Tex_IgnoreLevel* + + +Type Integer +Default Value 7 + +This setting defines a "filter level" or an "ignore level". A value of 7 for +instance means that any warning/error matching with any of the first 7 fields of +g:Tex_IgnoredWarnings [|ls_a_dA|] will be ignored. Setting this value to zero +will mean that no error/warning is ignored. However, even with a value of zero, +Latex-Suite will filter out most of the text which a LaTeX compiler typically +produces. Use > + TCLevel strict +from within Vim in order to see all the lines from the compiler's output. + + +g:Tex_UseMakefile *ls_11_6_7* *ls_a_dC* + *Tex_UseMakefile* + +Type boolean +Default Value 1 + +When set to 1, then if a makefile or Makefile is present in the current +directory, then Latex-Suite sets the makeprg option to just "make <target>", +where <target> is the target format chosen using the TCTarget or TTarget +commands. + +When set to 0, then Latex-Suite will set the makeprg setting to whatever is +defined by the g:Tex_CompileRule_target [|ls_a_dx|] setting. + + +g:Tex_GotoError *ls_11_6_8* *ls_a_dD* + *Tex_GotoError* + + +Type boolean +Default Value 1 + +If set to 1, then pressing \ll will take you to the location of the first +warning/error, otherwise you will remain in the original location but the +errors/warnings will be listed in the preview window. + +-------------------------------------------------------------------------------- +Viewer Customization *ls_11_7* *ls_a_dE* + *customizing-viewing* + +The following settings affect how Latex-Suite will display compiled files. + + + +g:Tex_ViewRule_<format> *ls_11_7_1* *ls_a_dF* + *Tex_ViewRule_format* + +Here <format> refers to a format such as dvi, ps, etc. This variable defines the +program which will be called to display a file of that format. + +By default, Latex-Suite defines viewer programs for viewing DVI, PS and PDF +formats as follows: + + Windows Unix~ +g:Tex_ViewRule_dvi 'yap -1' 'xdvi' +g:Tex_ViewRule_ps 'gsview32' 'ghostview' +g:Tex_ViewRule_pdf 'AcroRd32' 'xpdf' + +For Macintosh systems, these strings are left empty by default. This lets the +system pick the program for each format. If you define these variables for Mac, +the system choice will be over-ridden. + +Latex-Suite appends file.format to the above settings while calling the external +programs. For example, with > + let g:Tex_ViewRule_dvi = 'yap -1' +yap is called as > + !start yap -1 file.dvi +from within Vim. (The initial start is used on Windows platforms is to make yap +start as a separate process.) If you find the way Latex-Suite constructs the +command line too restrictive, you can use the Tex_ViewRuleComplete_format +[|ls_a_dG|] setting for more complete control on how the command line is +constructed while calling the external program for viewing. + +NOTE: For windows, you will need to set the $PATH variable to include the paths + to yap, AcroRd32, gsview32 and any other programs. See your system + documentation for how to do this. + + +NOTE: Default Viewing Format + ---------------------- + To change the default format for viewing files, set the + g:Tex_DefaultTargetFormat [|ls_a_dw|] variable. + + + + +Tex_ViewRuleComplete_<format> *ls_11_7_2* *ls_a_dG* + *Tex_ViewRuleComplete_format* + +Here <format> refers to the extension of a output format such as dvi, html etc. + +Tex_ViewRuleComplete_format takes precedence over Tex_ViewRule_format if both +are specified. By default, Latex-Suite does not define values for +Tex_ViewRuleComplete_format for any format. Unlike in the case of +Tex_ViewRule_format, Latex-Suite does not modify Tex_ViewRuleComplete_format at +all in constructing the command line. The only modification is to substitute +'$*' everywhere in the string with the name of the file being viewed (without +the extension). + +NOTE: IMPORTANT + --------- + Make sure you make the process go into the background otherwise vim will + wait for the viewer to terminate before letting you edit the file again. + + To make a process go into the background on a *nix platform, use a + trailing & in the setting. On Windows, use start at the beginning of the + setting. Example: Suppose you have a latex->html converter which converts + a file say foo.tex to a file foo/index.html. Then you would use: > + " On *nix platform + let g:Tex_ViewRuleComplete_html = 'MozillaFirebird $*/index.html &' + " On windows platform + let g:Tex_ViewRuleComplete_html = 'start MozillaFirebird $*/index.html' +< + + + +-------------------------------------------------------------------------------- +Menu Customization *ls_11_8* *ls_a_dH* + *customizing-menus* + +In addition to using the variables defined in this section to affect the +menu-layout permanently (i.e, the layout Latex-Suite will start with), you can +also use the TeX-Suite > Configure Menu menu to dynamically configure the menu +layout after Latex-Suite has started. + + + +g:Tex_Menus *ls_11_8_1* *ls_a_dI* + *Tex_Menus* + + +Type Boolean +Default Value 1 + +If set to 0, Latex-Suite will suppress showing all menus. Useful if you mostly +work in terminals. + + +g:Tex_MainMenuLocation *ls_11_8_2* *ls_a_dJ* + *Tex_MainMenuLocation* + + +Type number +Default Value 80 + +This setting decides the location of the first top-level Latex-Suite menu. You +can for example shift all the menus created by Latex-Suite to the very end by +setting this value to a large number like 990. + + +g:Tex_MathMenus *ls_11_8_3* *ls_a_dK* + *Tex_MathMenus* + + +Type Boolean +Default Value 1 + +The Tex-Math menu consists of hundreds of mathematical symbols used in LaTeX. +This menu comprises about 75% of the menus. + + +g:Tex_NestElementMenus *ls_11_8_4* *ls_a_dL* + *Tex_NestElementMenus* + + +Type Boolean +Default Value 1 + +This setting controls the "compactness" of the menus. If set to 1, then the +Font, Counter and Dimensioning menus are collected together in a single menu +called Tex-Elements, otherwise, they will each get a separate menu. + + +g:Tex_PackagesMenu *ls_11_8_5* *ls_a_dM* + *Tex_PackagesMenu* + + +Type Boolean +Default Value 1 + +Setting this to zero will stop Latex-Suite from automatically creating the +TeX-Suite > Packages > Supported menu at startup. You can still create the menu +after startup by going to TeX-Suite > Configure Menu. + + +g:Tex_NestPackagesMenu *ls_11_8_6* *ls_a_dN* + *Tex_NestPackagesMenu* + + +Type String +Default Value 'TeX-' + +This string is the prefix added to all the menus created by Latex-Suite. If you +define this variable with a dot ('.') as the last character, then all the menus +created by Latex-Suite will be nested under a single master menu. For example, +set this to '&LaTeX-Suite.' to nest all menus under a menu called &LaTeX-Suite. + + +g:Tex_UseUtfMenus *ls_11_8_7* *ls_a_dO* + *Tex_UseUtfMenus* + + +Type Boolean +Default Value 0 + +This setting controls whether Latex-Suite uses utf-8 symbols to display some of +the mathematical symbols in the TeX-Math menu. It is necessary for your +system/GUI to support utf-8. Setting this to 1 has the side-effect of setting +the 'encoding' option of Vim to 'utf-8'. + +-------------------------------------------------------------------------------- +Folding Customization *ls_11_9* *ls_a_dP* + *customizing-folding* + +The following settings control the folding [|ls_a_ci|] functionality of +Latex-Suite. + + + +g:Tex_Folding *ls_11_9_1* *ls_a_dQ* + *Tex_Folding* + + +Type Boolean +Default Value 1 + +Setting this to zero completely disables Latex-Suite's folding functionality. +However, the TexFoldTextFunction() is still available in case you want to use +another folding scheme but still want to continue using the fold text function. + + +g:Tex_AutoFolding *ls_11_9_2* *ls_a_dR* + *Tex_AutoFolding* + + +Type Boolean +Default Value 1 + +This setting controls whether Latex-Suite automatically creates manual folds for +a file when it is opened. You can still use the \rf mapping to refresh/create +folds even when this variable is set to zero. + +-------------------------------------------------------------------------------- +Package Handling Customization *ls_11_10* *ls_a_dS* + *customizing-packages* + +These settings affect the custom packages [|ls_a_bN|] functionality in +Latex-Suite + + + +g:Tex_TEXINPUTS *ls_11_10_1* *ls_a_dT* + *Tex_TEXINPUTS* + + +Type string +Default Value '' + +This setting describes the directories scanned by Latex-Suite while searching +for custom user packages as described in the custom packages [|ls_a_bN|] +section. Do not include the present directory in this setting. The present +directory is always scanned for custom packages. + +This string should be set in the syntax accepted by Vim's native 'path' setting. + +================================================================================ +Credits *ls_12* *ls_a_dU* + *latex-suite-credits* + + + +And finally, the credits: + + +Artur R. Czechowski maintains the BSD package of Latex-Suite. Lots of valuable + feedback. +Lubomir Host provided the diacritics and also helped in development. +Alexander Wagner valuable suggestions during development. +Luc Hermitte his variation of Stephen Riehm's bracketing system is used + in Latex-Suite. +Gergely Kontra the clever little JumpFunc() in imaps.vim is due to him. + The implementation of the templates also borrows from + mu-template.vim by him. +Dimitri Antoniou author of ltags and also provided the nice tip about + forward / reverse search on DVI documents. +Stephen Riehm the extremely helpful bracketing system is from him. +Alan Schmitt provided macros/folding elements. Continued feedback, + bug-reports/fixes. +Hari Krishna Dara for ExecMap(), the clever little function which makes + typing visual mode mappings so much easier and error-free. +Alan G Isac for the comprehensive BibT() function for entering bibtex + entries. +Gontran Baerts for libList.vim +Peter Heslin useful discussion and also a lot of bug fixes. the + %%fakesection in folding.vim. +Zhang Lin-bo lots of very useful additions to folding. The code for + customizing the folding scheme is due to him. + +A large number of functions in Latex-Suite come from various other people. Some +of those people might have been missed here. Each function should however have +the author's name/e-mail above it. Thats the more authoritative place to check +out who has done what. + + *latex-suite-maintainer* *ls_a_eC* +The current maintainer(s) of Latex-Suite is(are) + + +Srinath Avadhanula <srinath@fastmail.fm> + +Mikolaj Machowski <mikmach@wp.pl> + +Benji Fisher <benji@member.AMS.org> + +================================================================================ +URLs used in this file + +*ls_u_1* : http://vim-latex.sourceforge.net +*ls_u_10* : http://developer.kde.org/~kdvi/ +*ls_u_11* : http://okular.kde.org/ +*ls_u_12* : http://math.berkeley.edu/~vojta/xdvi.html +*ls_u_13* : http://xdvi.sourceforge.net/ +*ls_u_14* : http://itexmac.sourceforge.net/pdfsync.html +*ls_u_2* : http://vim-latex.sourceforge.net/index.php?subject=download +*ls_u_3* : http://www.cygwin.com +*ls_u_4* : http://www.google.com/search?q=windows%20gnu%20grep +*ls_u_5* : http://skim-app.sourceforge.net/ +*ls_u_6* : http://pdfview.sourceforge.net/ +*ls_u_7* : http://www2.ing.unipi.it/~d9615/homepage/texniscope.html +*ls_u_8* : http://www.miktex.org/ +*ls_u_9* : http://blog.kowalczyk.info/software/sumatrapdf/ + +================================================================================ +About this file + +This file was created automatically from its XML variant using db2vim. db2vim is +a python script which understands a very limited subset of the Docbook XML 4.2 +DTD and outputs a plain text file in vim help format. + +db2vim can be obtained via anonymous CVS from sourceforge.net. Use + +cvs -d:pserver:anonymous@cvs.vim-latex.sf.net:/cvsroot/vim-latex co db2vim + +Or you can visit the web-interface to sourceforge CVS at: +http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/db2vim/ + +The following modelines should nicely fold up this help manual. + +vim:ft=help:fdm=expr:nowrap +vim:foldexpr=getline(v\:lnum-1)=~'-\\{80}'?'>2'\:getline(v\:lnum-1)=~'=\\{80}'?'>1'\:getline(v\:lnum)=~'=\\{80}'?'0'\:getline(v\:lnum)=~'-\\{80}'?'1'\:'=' +vim:foldtext=substitute(v\:folddashes.substitute(getline(v\:foldstart),'\\s*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') +================================================================================ diff --git a/vim-latex/doc/latex-suite.xml b/vim-latex/doc/latex-suite.xml new file mode 100644 index 0000000..e2c7d08 --- /dev/null +++ b/vim-latex/doc/latex-suite.xml @@ -0,0 +1,4665 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> + +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "docbook-xml/docbookx.dtd" +[<!ENTITY dummy "dummy"> + <!ENTITY date "$Date$"> + <!ENTITY ls "Latex-Suite"> + <!ENTITY latex "LaTeX"> + <!ENTITY vim "Vim"> + <!ENTITY ph "<++>"> +]> +<article lang="en"> + <articleinfo id="articleinfo"> + + <title id="articleinfo-title">&ls; Reference</title> + + <author> + <firstname>Srinath</firstname> + <surname>Avadhanula</surname> + <affiliation> + <address><email>srinath AT fastmail DOT fm</email></address> + </affiliation> + </author> + <author> + <firstname>Mikolaj</firstname> + <surname>Machowski</surname> + <affiliation> + <address><email>mikmach AT wp DOT pl</email></address> + </affiliation> + </author> + + <date>&date;</date> + <abstract> + <para> + &ls; attempts to provide a comprehensive set of tools to + view, edit and compile LaTeX documents in Vim. Together, they + provide tools starting from macros to speed up editing LaTeX + documents to functions for forward searching .dvi documents. + &ls; has been possible because of the contributions of many + people. Please see <link + linkend="latex-suite-credits">latex-suite-credits</link> for a list of + people who have helped. + </para> + <para> + &ls; is released under the Vim charityware license. For + license and conditions of use look at |copyright|. Replace all + occurrences of ``Vim'' with ``Latex-Suite''. The current copyright + holders of &ls; are Srinath Avadhanula and Mikolaj Machowski. + </para> + <para> + Homepage: <ulink url="http://vim-latex.sourceforge.net">http://vim-latex.sourceforge.net</ulink> + </para> + </abstract> + </articleinfo> + <section id="recommended-settings"> + <title>Installation and recommended Settings</title> + <para> + If you are reading this, it most probably means that you have already + installed &ls; and the help files. If this is not the case, follow the + detailed instructions on <ulink + url="http://vim-latex.sourceforge.net/index.php?subject=download">&ls;'s + download page</ulink>. + </para> + <para> + Make sure that you create a few necessary settings in your + <literal>~/.vimrc.</literal> + <programlisting> +" REQUIRED. This makes vim invoke &ls; when you open a tex file. +filetype plugin on + +" IMPORTANT: win32 users will need to have 'shellslash' set so that latex +" can be called correctly. +set shellslash + +" IMPORTANT: grep will sometimes skip displaying the file name if you +" search in a singe file. This will confuse &ls;. Set your grep +" program to always generate a file-name. +set grepprg=grep\ -nH\ $* + +" OPTIONAL: This enables automatic indentation as you type. +filetype indent on + +" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to +" 'plaintex' instead of 'tex', which results in vim-latex not being loaded. +" The following changes the default filetype back to 'tex': +let g:tex_flavor='latex' +</programlisting> + </para> + <para> + In addition, the following settings could go in your ~/.vim/ftplugin/tex.vim + file: + <programlisting>" this is mostly a matter of taste. but LaTeX looks good with just a bit +" of indentation. +set sw=2 +" TIP: if you write your \label's as \label{fig:something}, then if you +" type in \ref{fig: and press <C-n> you will automatically cycle through +" all the figure labels. Very useful! +set iskeyword+=: +</programlisting> + </para> + </section> + <section id="latex-suite-templates"> + <title>Inserting Templates</title> + <para> + This functionality is available via the <literal>TeX-Suite > + Templates</literal> menu. + This module provides a way to insert custom templates at the beginning of the + current file. + </para> + <para> + When &ls; first starts up, it scans the + <literal>$VIM/ftplugin/latex-suite/templates/</literal> + directory and creates menu items based on the files found there. When + you select a template from this menu, the file will be read in above + the first line of the current file. + </para> + <para> + A template file can utilize placeholders for initializing the cursor + position when the template is read in and subsequent movement. In + addition, template files can contain dynamic elements such as the + time of creation of a file etc, by using vim expressions. + </para> + <para> + You can place your own templates in the + <literal>$VIM/ftplugin/latex-suite/templates/</literal> directory in + order for them to be available via the menu. Unless &ls; releases a + template with the same name, these files should not get over-written + when you install a new release over an existing one. + </para> + <note> + <para> + Templates are also accessible for non-gui users with the command + |<literal>:TTemplate</literal>|. The argument should be name of + the corresponding template file. If the command is called + without arguments (preferred usage), then a list of available + templates is displayed and the user is asked to choose one of + them. + </para> + </note> + </section> + <section id="latex-macros"> + <title>&ls; Macros</title> + <para> + &ls; ships with a very comprehensive set of insert mode and + |visual-mode| mappings and menu items to typeset most of the LaTeX + elements. + </para> + <note> + <para> + These mappings are are not standard mappings in the sense that + only the last character is mapped. See plugin/imaps.vim for + further documentation. For example, in the case of the mapping + <literal>EFI</literal> provided by &ls; you can press the characters + '<literal>E</literal>', '<literal>F</literal>' and '<literal>I</literal>' + as slowly as you wish (unlike the normal <literal>imap</literal> command + where <literal>timeout</literal> issues are involved). The characters are + visible as you type them (unlike normal <literal>imap</literal>s) and you + can use the movement or backspace key to correct yourself unlike normal + mappings. + </para> + </note> + <anchor id="place-holder" /> + <note id="place-holders"> + <title>Place Holders</title> + <para> + Almost all macros provided in &ls; implement Stephen Riem's bracketing + system and Gergely Kontra's <literal>JumpFunc()</literal> for handling + place-holders. This consists of using "place-holders" to mark off + locations where the next relevant editing has to be done. As an example, + when you type <literal>EFI</literal> in |insert-mode|, you will get the + following: + <programlisting>\begin{figure}[h] + \centerline{\psfig{figure=<+eps file+>}} + \caption{<+caption text+>} + \label{fig:<+label+>} +\end{figure}<++></programlisting> + The text <literal><+eps file+></literal> will be selected and + you will be left in |select-mode| so that you can continue typing + straight away. After having typed in the file name, you can press + <literal><Ctrl-J></literal> (while still in insert-mode). This will + take you directly to the next "place-holder". i.e, <literal><+caption + text+></literal> will be visually selected with Vim in select mode + again for typing in the caption. This saves on a lot of key presses. + </para> + </note> + <note id="overriding-macros"> + <title>Over-riding &ls; Macros</title> + <para> + If you wish to change these macros from their default values, for + example, if you wish to change <literal>`w</literal> to expand to + <literal>\omega</literal> instead of its default expansion to + <literal>\wedge</literal>, you should use the <literal>IMAP</literal> + function as described in the <link linkend="ls-new-macros">Using + IMAP()</link> section. + </para> + <para> + An important thing to note is that if you wish to over-ride macros + created by &ls; rather than merely create new macros, you should place + the <literal>IMAP()</literal> calls in a script which gets sourced + after the files in &ls;. A good place typically is as a file-type + plugin file in the + <literal>~/.vim/after/ftplugin/</literal> directory. (Use + <literal>~/vimfiles</literal> if you are using + <literal>WINDOWS</literal>). For example to over-ride + <literal>`w</literal> to <literal>\omega</literal> instead of + <literal>\wedge</literal>, place the following line in (say) + <literal>~/.vim/after/ftplugin/tex_macros.vim</literal>: + <programlisting>call IMAP('`w', '\omega', 'tex')</programlisting> + </para> + <note> + <para> + It is important to use a file-name which will get sourced on a + <literal>FileType</literal> event. Therefore you must use a file-name + which conforms to the standards as described in + <literal>|ftplugin-name|</literal>. + </para> + </note> + </note> + <note id="pausing-imaps"> + <title>Pausing Macro expansion</title> + <para> + If you wish to temporarily suspend the imaps functionality, then you + can set the <literal>Imap_FreezeImap</literal> to 1. If you set + <literal>g:Imap_FreezeImap</literal> to 1, then it will be a + system-wide setting. Setting <literal>b:Imap_FreezeImap</literal> will + affect only the current buffer. + </para> + </note> + <para> + The following sections describe the various editing macros provided + by &ls;. + </para> + <section id="environment-mappings"> + <title>Environment Mappings</title> + &ls; provides a rich set of mappings to insert, enclose and modify + &latex; environments, i.e, <literal>\begin{...} ... \end{...}</literal> + pairs. + <section id="inserting-environments"> + <title>Inserting Environments</title> + <para> + &ls; provides the following ways to insert environments + </para> + <section id="inserting-env-f5"> + <title>Method 1: Pressing <literal><F5></literal></title> + <para> + If you press <literal><F5></literal> in the insert or normal + mode while on an empty line, &ls; prompts you with a list of + environments you might want to insert. You can either choose one + from the list or type in a new environment name. If you press + <literal><F5></literal> on a line which already has a word, + then that word is used instead of prompting. + </para> + <para> + See <link linkend="Tex_Env_name">Tex_Env_name</link> for a + description of how &ls; uses the word to form the expansion and how + to modify &ls;'s behavior. + </para> + <para> + The list of environments which &ls; prompts you with (when + <literal><F5></literal> is pressed on an empty line) is formed + from the <link + linkend="Tex_PromptedEnvironments">Tex_PromptedEnvironments</link> + setting. + </para> + <para> + In addition to this setting, &ls; also lists environments found in + custom packages as described in the section <link + linkend="package-actions">Package actions.</link> + </para> + </section> + <section id="inserting-env-shift-f1"> + <title>Method 2: Using <literal><S-F1></literal>-<literal><S-F4></literal></title> + <para> + The shifted function keys, <literal><S-F1></literal> to + <literal><S-F4></literal> can be mapped to insert very commonly + used environments. The environments mapped to each key can be + customized via the <link + linkend="Tex_HotKeyMappings">g:Tex_HotKeyMappings</link> setting. + </para> + </section> + <section id="inserting-env-threeletter"> + <title>Method 3: Using three letter sequences</title> + <para> + Environments can also be inserted by pressing a 3 capital letter + sequence starting with an <literal>E</literal>. The sequence of 3 + letters generally tries to follow the following rules: + </para> + <orderedlist> + <listitem> + All environment mappings begin with <literal>E</literal> + </listitem> + <listitem> + If the environment can be broken up into 2 distinct words, + such as flushright (flush + right), then the next 2 letters + are the first letters of the 2 words. Example: + <programlisting>flushleft (_f_lush + _l_eft) ---> EFL +flushright (_f_lush + _r_ight) ---> EFR +eqnarray (_e_qn + _a_rray) ---> EEA</programlisting> + If on the other hand, the environment name cannot be broken + up into 2 distinct words, then the next 2 letters are the + first 2 letters of the name of the environment. + Example: + <programlisting>equation (_eq_uation) ---> EEQ</programlisting> + </listitem> + </orderedlist> + <para> + Unfortunately there are some environments that cannot be + split in two words and first two letters in name are + identical. In this case shortcut is created from E, first and + last letter. Example: + <programlisting>quote (_q_uot_e_) ---> EQE +quotation (_q_uotatio_n_) ---> EQN</programlisting> + Of course, not every last one of the environments can follow + this rule because of ambiguities. In case of doubt, pull down + the Tex-Environments menu. The menu item should give the hint + for the map. + </para> + </section> + </section> + <section id="enclosing-environments"> + <title>Enclosing in Environments</title> + <para> + &ls; provides visual-mode mappings which enclose visually + selected portions of text in environments. There are two ways provided + to do this. + </para> + <section id="enclosing-env-f5"> + <title>Method 1: Pressing <literal><F5></literal></title> + <para> + You can also select a portion of text visually and press + <literal><F5></literal> while still in visual mode. This will + prompt you with a list of environments. (This list can be customized + via the <link + linkend="Tex_PromptedEnvironments">g:Tex_PromptedEnvironments</link> + setting). You can either choose from this list or type in a new + environment name. Once the selection is done, &ls; encloses the + visually selected portion in the chosen environment. + </para> + </section> + <section id="enclosing-env-threeletter"> + <title>Method 2: Using three letter mappings</title> + <para> + You can also select text visually and press a sequence of three + characters beginning with <literal>,</literal> (the single comma + character) and the selected text will be enclosed in the chosen + environment. The three letter sequence follows directly from the + three letter sequence used to insert environments as described <link + linkend="inserting-env-threeletter">here</link>. The following + example describes the rule used: + </para> + <para> + If <literal>ECE</literal> inserts a + <literal>\begin{center}...\end{center}</literal> environment, then to + enclose a block of selected text in + <literal>\begin{center}...\end{center}</literal>, simply select the + text and press <literal>,ce</literal>. The rule simply says that the + leading <literal>E</literal> is converted to <literal>,</literal> and + the next 2 letters are small case. + </para> + </section> + <para> + Some of the visual mode mappings are sensitive to whether you + choose line-wise or character-wise. For example, if you choose a + word and press <literal>,ce</literal>, then you get + <literal>\centerline{word}</literal>, whereas if you press + <literal>,ce</literal> on a line-wise selection, you get: + <programlisting>\begin{center} + line +\end{center}</programlisting> + </para> + </section> + <section id="changing-environments"> + <title>Changing Environments</title> + <para> + Pressing <literal><S-F5></literal> in normal mode detects which + environment the cursor is presently located in and prompts you to + replace it with a new one. The innermost environment is detected. For + example, in the following source: + <programlisting>\begin{eqnarray} + \begin{array}{ccc} + 2 & 3 & 4 + \end{array} +\end{eqnarray}</programlisting> + if you are located in the middle "2 & 3 & 4" line, then pressing + <literal><S-F5></literal> will prompt you to change the array + environment, not the eqnarray environment. In addition, &ls; will also + try to change lines within the environment to be consistent with the + new environment. For example, if the original environment was an + <literal>eqnarray</literal> environment with a + <literal>\label</literal> command, then changing it to an + <literal>eqnarray*</literal> environment will delete the + <literal>\label</literal>. + </para> + <para> + Pressing <literal><F5></literal> in normal mode has the same + effect as pressing <literal><F5></literal> in insert-mode, + namely you will be prompted to choose an environment to insert. + </para> + </section> + </section> + <section id="latex-command-maps"> + <title>Command Mappings</title> + &ls; provides a rich set of mappings to insert, enclose and modify + &latex; commands. + <section id="inserting-commands"> + <title>Inserting &latex; commands</title> + <anchor id="ls-imap-f7" /> + <anchor id="ls-imap-s-f7" /> + <para> + Pressing <literal><F7></literal> in insert or normal mode while + the cursor is touching a word will insert a command formed from the + word touching the cursor. + </para> + <para> + For certain common commands, &ls; will expand them to include + additional arguments as needed. For example, <literal>frac</literal> + becomes <literal>\frac{&ph;}{&ph;}&ph;</literal>. Otherwise, it will + simply change the word under the cursor as follows + <programlisting>word --> \word{&ph;}&ph;</programlisting> + You can define custom expansions + of commands using the <literal>Tex_Com_{name}</literal> setting as + described in <link linkend="Tex_Com_name">here</link>. + </para> + <para> + If <literal><F7></literal> is pressed when the cursor is on + white-space, then &ls; will prompt you to choose a command and insert + that instead.The list of commands is constructed from the <link + linkend="Tex_PromptedCommands"><literal>g:Tex_PromptedCommands</literal></link> + setting and also from commands which &ls; finds while scanning custom + packages which &ls; finds. See the <link + linkend="package-actions">Package actions</link> section for details + on which files are scanned etc. + </para> + </section> + <section id="enclosing-commands"> + <title>Enclosing in a command</title> + <para> + You can select a portion of text visually and press + <literal><F7></literal> while still in visual mode. This will + prompt you with a list of commands. (This list can be customized + via the <link + linkend="Tex_PromptedCommands">g:Tex_PromptedCommands</link> + setting). You can either choose from this list or type in a new + command name. Once the selection is done, &ls; encloses the + visually selected portion in the chosen command. + </para> + </section> + <section id="changing-commands"> + <title>Changing commands</title> + <anchor id="ls-vmap-f7" /> + <para> + In both insert and normal mode <literal><S-F7></literal> will + find out if you are presently within an environment and then prompt you + with a list of commands to change it to. + </para> + </section> + </section> + <section id="font-maps"> + <title>Font Mappings</title> + <para> + These mappings insert font descriptions such as: + <literal>\textsf{&ph;}&ph;</literal> + with the cursor left in place of the first <link + linkend="place-holders">placeholder</link> (the &ph; characters). + </para> + <para> + Mnemonic: + <orderedlist> + <listitem>first letter is always F (F for font)</listitem> + <listitem>next 2 letters are the 2 letters describing the font.</listitem> + </orderedlist> + </para> + <para> + Example: Typing <literal>FEM</literal> in insert-mode expands to + <literal>\emph{&ph;}&ph;</literal>. + </para> + <para> + Just like environment mappings, you can visually select an area and press + <literal>`sf</literal> to have it enclosed in: + <literal>\textsf{word}</literal> + or + <programlisting>{\sffamily +line +}</programlisting> + depending on character-wise or line-wise selection. + </para> + </section> + <section id="section-mappings"> + <title>Section Mappings</title> + <para> + These maps insert &latex; sections such as: + <programlisting>\section{&ph;}&ph;</programlisting> + etc. Just as in the case of environments and fonts, can be enclosed with a + visual selection. The enclosing is not sensitive to character or line-wise + selection. + </para> + <para> + Mnemonic: (make your own!) + <programlisting>SPA for part +SCH for chapter +SSE for section +SSS for subsection +SS2 for subsubsection +SPG for paragraph +SSP for subparagraph</programlisting> + </para> + <para> + Example: + SSE in insert mode inserts + <programlisting>\section{<++>}<++></programlisting> + If you select a word or line and press <literal>,se</literal>, then you + get + <programlisting>\section{section name}</programlisting> + The menu item in Tex-Environments.Sections have a sub-menu called + 'Advanced'. Choosing an item from this sub-menu asks a couple of questions + (whether you want to include the section in the table of contents, whether + there is a shorter name for the table of contents) and then creates a more + intelligent template. + </para> + </section> + <section id="greek-letter-mappings"> + <title>Greek Letter Mappings</title> + <para> + Lower case + </para> + <literal>`a</literal> through <literal>`z</literal> expand to + <literal>\alpha</literal> through <literal>\zeta</literal>. + <para> + Upper case: + </para> + <programlisting>`D = \Delta +`F = \Phi +`G = \Gamma +`Q = \Theta +`L = \Lambda +`X = \Xi +`Y = \Psi +`S = \Sigma +`U = \Upsilon +`W = \Omega</programlisting> + <note><para>LaTeX does not support upper case for all greek alphabets.</para></note> + <para>Just like other &ls; mappings, these mappings are not created using + the standard <literal>imap</literal> command. Thus you can type slowly, + correct using <literal><BS></literal> etc.</para> + </section> + <section id="auc-tex-mappings"> + <title>Auc-Tex Key Bindings</title> + <para> + These are simple 2 key expansions for some very commonly used LaTeX + elements: + </para> + <programlisting>`^ Expands To \Hat{&ph;}&ph; +`_ expands to \bar{&ph;}&ph; +`6 expands to \partial +`8 expands to \infty +`/ expands to \frac{&ph;}{&ph;}&ph; +`% expands to \frac{&ph;}{&ph;}&ph; +`@ expands to \circ +`0 expands to ^\circ +`= expands to \equiv +`\ expands to \setminus +`. expands to \cdot +`* expands to \times +`& expands to \wedge +`- expands to \bigcap +`+ expands to \bigcup +`( expands to \subset +`) expands to \supset +`< expands to \le +`> expands to \ge +`, expands to \nonumber +`~ expands to \tilde{&ph;}&ph; +`; expands to \dot{&ph;}&ph; +`: expands to \ddot{&ph;}&ph; +`2 expands to \sqrt{&ph;}&ph; +`| expands to \Big| +`I expands to \int_{&ph;}^{&ph;}&ph;</programlisting> + <para> + (again, notice the convenient place-holders) + </para> + <para> + In addition the visual mode macros are provided: + </para> + <programlisting>`( encloses selection in \left( and \right) +`[ encloses selection in \left[ and \right] +`{ encloses selection in \left\{ and \right\} +`$ encloses selection in $$ or \[ \] depending on characterwise or + linewise selection</programlisting> + </section> + <section id="diacritic-mappings"> + <title>Diacritics</title> + <para> + These mappings speed up typing European languages which contain diacritic + characters such as a-umlaut etc. + <programlisting>+<l> expands to \v{<l>} +=<l> expands to \'{<l>}</programlisting> + where <literal><l></literal> is an alphabet. + </para> + <programlisting>+} expands to \"{a} ++: expands to \^{o}</programlisting> + <para> + &ls; also ships with <link linkend="smart-backspace">smart + backspacing</link> functionality which provides another convenience while + editing languages with diacritics. + </para> + <note> + <para>Diacritics are disabled by default in &ls; because they can + sometimes be a little too intrusive. Moreover, most European users can + nowadays use font encodings which display diacritic characters directly + instead of having to rely on &ls;'s method of displaying diacritics.</para> + <para>Set the <link linkend="Tex_Diacritics">g:Tex_Diacritics</link> + variable to enable diacritics.</para> + </note> + </section> + <section id="bibtex-bindings"> + <title>BibTeX Shortcuts</title> + <para> + &ls; provides an easy way of entering bibliographic entries. Four + insert-mode mappings: <literal>BBB</literal>, <literal>BBL</literal>, + <literal>BBH</literal> and <literal>BBX</literal> are provided, all of + which essentially act in the same manner. When you type any of these in + insert-mode, you will get a prompt asking you to choose a entry type + for the bibliographic entry. + </para> + <para> + When you choose an entry type, a bibliographic entry template will be + inserted. For example, if you choose the option + <literal>'book'</literal> via the map <literal>BBB</literal>, then + the following template will be inserted: + <programlisting>@BOOK{<+key+>, + author = {&ph;}, + editor = {&ph;}, + title = {&ph;}, + publisher = {&ph;}, + year = {&ph;}, + otherinfo = {&ph;} +}&ph;</programlisting> + </para> + <para> + <literal><+key+></literal> will be highlighted in select-mode and + you can type in the bib-key. After that you can use + <literal><Ctrl-J></literal> to navigate to successive locations + in the template and enter new values. + </para> + <para> + <literal>BBB</literal> inserts a template with only the fields + mandatorily required for a given entry type. <literal>BBL</literal> + inserts a template with commonly used extra options. + <literal>BBH</literal> inserts a template with more options which are + not as commonly used. <literal>BBX</literal> inserts a template with + all the fields which the entry type supports. + </para> + <note> + <title>Mnemonic</title> + <para> + <literal>B</literal> for Bibliographic entry, <literal>L</literal> + for Large entry, <literal>H</literal> for Huge entry, and + <literal>X</literal> stands for all eXtras. + </para> + </note> + <section id="adding-bib-options"> + <title>Customizing Bib-TeX fields</title> + <para> + If you wish the <literal>BBB</literal> command to insert a few + additional fields in addition to the fields it creates, then you will + need to define global variables of the form + <programlisting>g:Bib_{type}_options</programlisting> + in you <literal>$VIM/ftplugin/bib.vim</literal> file, where + <literal>{type}</literal> is a string like + <literal>'article'</literal>, <literal>'book'</literal> etc. This + variable should contain one of the letters defined in the following + table + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Character</entry> + <entry>Field Type</entry> + </row> + </thead> + <tbody> + <row><entry>w</entry><entry>address</entry></row> + <row><entry>a</entry><entry>author</entry></row> + <row><entry>b</entry><entry>booktitle</entry></row> + <row><entry>c</entry><entry>chapter</entry></row> + <row><entry>d</entry><entry>edition</entry></row> + <row><entry>e</entry><entry>editor</entry></row> + <row><entry>h</entry><entry>howpublished</entry></row> + <row><entry>i</entry><entry>institution</entry></row> + <row><entry>k</entry><entry>isbn</entry></row> + <row><entry>j</entry><entry>journal</entry></row> + <row><entry>m</entry><entry>month</entry></row> + <row><entry>z</entry><entry>note</entry></row> + <row><entry>n</entry><entry>number</entry></row> + <row><entry>o</entry><entry>organization</entry></row> + <row><entry>p</entry><entry>pages</entry></row> + <row><entry>q</entry><entry>publisher</entry></row> + <row><entry>r</entry><entry>school</entry></row> + <row><entry>s</entry><entry>series</entry></row> + <row><entry>t</entry><entry>title</entry></row> + <row><entry>u</entry><entry>type</entry></row> + <row><entry>v</entry><entry>volume</entry></row> + <row><entry>y</entry><entry>year</entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + For example, by default, choosing <literal>'article'</literal> via + <literal>BBB</literal> inserts the following template by default + <programlisting>@ARTICLE{<+key+>, + author = {&ph;}, + title = {&ph;}, + journal = {&ph;}, + year = {&ph;}, + otherinfo = {&ph;} +}&ph;</programlisting> + However, if <literal>g:Bib_article_options</literal> is defined as + <literal>'mnp'</literal>, then <literal>'article'</literal> will + insert the following template + <programlisting>@ARTICLE{<+key+>, + author = {&ph;}, + title = {&ph;}, + journal = {&ph;}, + year = {&ph;}, + month = {&ph;}, + number = {&ph;}, + pages = {&ph;}, + otherinfo = {&ph;} +}&ph;</programlisting> + </para> + <para> + If you have some other fields you wish to associate with an article + which are not listed above, then you will have to use the + <literal>Bib_{type}_extrafields</literal> option. This is a newline + separated string of complete field names which will be included in the + template. For example, if you define + <programlisting>let g:Bib_article_extrafields = "crossref\nabstract"</programlisting> + then the article template will include the lines + <programlisting>crossref = {&ph;}, +abstract = {&ph;},</programlisting> + </para> + <note> + <para> + You will need to define <literal>Bib_*</literal> settings in your + <literal>$VIMRUNTIME/ftplugin/bib.vim</literal> file. + </para> + </note> + </section> + </section> + <section id="smart-keys"> + <title>Smart Key Mappings</title> + <para> + &ls; ships with the following smart keys: + </para> + <formalpara> + <anchor id="smart-backspace" /> + <title>Smart Backspace</title> + Pressing <literal><BS></literal> in insert mode checks to see + whether we are just after something like <literal>\'{a}</literal> and + if so, deletes all of it. i.e, diacritics are treated as single + characters for backspacing. + </formalpara> + <formalpara> + <title>Smart Quotes</title> + Pressing <literal>"</literal> (English double quote) will insert + <literal>``</literal> or <literal>''</literal> by making an + intelligent guess about whether we intended to open or close a quote. + </formalpara> + <formalpara> + <title>Smart Space</title> + &ls; maps the <literal><space></literal> key in such a + way that $ characters are not broken across lines. It does this by + first setting <literal>tw=0</literal> so that Vim will not + automatically break lines and then maps the + <literal><space></literal> key to insert newlines keeping + <literal>$$</literal>'s on the same line. + </formalpara> + <formalpara> + <title>Smart Dots</title> + Pressing <literal>...</literal> (3 dots) results in + <literal>\ldots</literal> outside math mode and + <literal>\cdots</literal> in math mode. + </formalpara> + </section> + <section id="altkey-mappings"> + <title>Alt Key Macros</title> + <para> + &ls; utilizes a set of macros originally created by Carl Mueller in + auctex.vim to make inserting all the <literal>\left ... \right</literal> + stuff very easy and to also make some use of the heavily under-utilized + <literal><Alt></literal> key. + </para> + <note> + <para> + By default, typing <literal>Alt-<key></literal> in &vim; takes + focus to the menu bar if a menu with the hotkey + <literal><key></literal> exists. If in your case, there are + conflicts due to this behavior, you will need to set + <programlisting>set winaltkeys=no</programlisting> + in your <literal>$VIM/ftplugin/tex.vim</literal> in order to use these + maps. + </para> + </note> + <note> + <title>Customizing the maps</title> + <para> + If for some reason, you wish to not map the + <literal><Alt></literal> keys, (some European users need to use + the <literal><Alt></literal> key to enter diacritics), you can + change these maps to other keys as described in the section <link + linkend="customize-alt-key-maps">Customizing Alt-key maps</link>. + </para> + </note> + <section id="Alt-L"> + <title><literal><Alt-L></literal></title> + <para> + This is a polymorphic insert-mode mapping which expands to one of the + following depending on the character just before the cursor location. + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <colspec colwidth="0.5in" align="cener" /> + <colspec colwidth="0.5in" /> + <thead> + <row> + <entry>Character before cursor</entry> + <entry>Expansion</entry> + </row> + </thead> + <tbody> + <row><entry>(</entry> <entry><literal>\left( &ph; \right)</literal></entry></row> + <row><entry>[</entry> <entry><literal>\left[ &ph; \right]</literal></entry></row> + <row><entry>|</entry> <entry><literal>\left| &ph; \right|</literal></entry></row> + <row><entry>{</entry> <entry><literal>\left\{ &ph; \right\}</literal></entry></row> + <row><entry><</entry> <entry><literal>\langle &ph; \rangle</literal></entry></row> + <row><entry>q</entry> <entry><literal>\lefteqn{&ph;}&ph;</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If the character before the cursor is none of the above, then it will + simply insert a <literal>\label{&ph;}&ph;</literal>. + </para> + </section> + <section id="Alt-B"> + <title><literal><Alt-B></literal></title> + <para> + This insert-mode mapping encloses the previous character in + <literal>\mathbf{}</literal>. + </para> + </section> + <section id="Alt-C"> + <title><literal><Alt-C></literal></title> + <para> + In insert mode, this key is polymorphic as follows: + </para> + <orderedlist> + <listitem> + If the previous character is a letter or number, then capitalize it and + enclose it in <literal>\mathcal{}</literal>. + </listitem> + <listitem> + otherwise insert <literal>\cite{}</literal>. + </listitem> + </orderedlist> + <para> + In visual mode, it will simply enclose the selection in + <literal>\mathcal{}</literal> + </para> + </section> + <section id="Alt-I"> + <title><literal><Alt-I></literal></title> + <para> + This mapping inserts an <literal>\item</literal> command at the + current cursor location depending on which environment the cursor is + enclosed in. The style of the <literal>\item</literal> command is + dependent on the enclosing environment. By default, + <literal><Alt-I></literal> has styles defined forthe following + environments: + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Environment</entry> + <entry>Style</entry> + </row> + </thead> + <tbody> + <row><entry>itemize</entry><entry>\item </entry></row> + <row><entry>enumerate</entry><entry>\item </entry></row> + <row><entry>theindex</entry><entry>\item </entry></row> + <row><entry>thebibliography</entry><entry>\item[<+biblabel+>]{<+bibkey+>} <++></entry></row> + <row><entry>description</entry><entry>\item[<+label+>] <++></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + <literal><Alt-I></literal> is intelligent enough to + account for nested environments. For example, + <programlisting>\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</programlisting> + </para> + <para> + The style used by <literal><Alt-I></literal> can be customized + using the <link + linkend="Tex_ItemStyle_environment"><literal>g:Tex_ItemStyle_environment</literal></link> + variable. + </para> + </section> + </section> + <section id="custom-macros-menu"> + <title>Custom Macros</title> + <para> + This functionality available via the TeX-Suite.Macros menu, provides + a way of inserting customized macros into the current file via the + menu. + </para> + <para> + When &ls; starts up, it scans the + <literal>$VIM/ftplugin/latex-suite/macros/</literal> directory and + creates a menu from the files found there. Each file is considered as + a single macro. You can place your own macros in this directory, + using <link linkend="place-holders">placeholders</link> if wanted. + </para> + <para> + When you choose a macro from the menu, the corresponding file is read + into the current buffer after the current cursor position. In non-gui + mode, you can use the |TMacro| command instead of choosing from the + menu. This command takes the macro file name as an argument. When + called without arguments (preferred usage), then a list of available + macro files is displayed and the user is prompted to choose one of + them). + </para> + <para> + There are some other tools provided in this menu, namely: + </para> + <informaltable frame="none"> + <tgroup cols="2"> + <colspec colwidth="0.5in" /> + <colspec colwidth="0.5in" /> + <tbody> + <row><entry>{New}</entry> + <entry> + Creates a new (unnamed) buffer in the + latex-suite/macros/ directory. Use the command + :TexMacroNew in non-gui mode. + </entry> + </row> + <row> + <entry>{Edit}</entry> + <entry> + Opens up the corresponding macro file for editing. Use + |:TexMacroEdit| in non-gui mode. When you try to edit {macro} + not from local directory &ls; will copy it to your local + directory with suffix "-local". If local copy already exists + &ls; prompt for overwriting it. + </entry> + </row> + <row> + <entry>{Delete}</entry> + <entry> + Deletes the corresponding macro. Use the prefixed numbers for + fast navigation of menus. Use |:TexMacroDelete| in non-gui mode. + When you choose to delete {macro} which is not in your local + directory &ls; will refuse to delete it. + </entry> + </row> + <row> + <entry>{Redraw}</entry> + <entry> + Rescans the macros/ directories and refreshes the macros list. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + <section id="ls-new-macros"> + <title>Making your own Macros via <literal>IMAP()</literal></title> + <para> + If you find the need to create your own macros, then you can use the + <literal>IMAP()</literal> function provided with &ls;. See <link + linkend="why-IMAP" endterm="why-IMAP.title"></link> for a short + explanation of why you might prefer <literal>IMAP()</literal> over + &vim;'s standard <literal>:imap</literal> command. An example best + explains the usage: + <programlisting>:call IMAP('NOM', '\nomenclature{&ph;}&ph;', 'tex')</programlisting> + This will create a &ls;-style mapping, where if you type + <literal>NOM</literal> in insert mode, you will get + <literal>\nomenclature{&ph;}&ph;</literal> with the cursor left in + place of the first <literal>&ph;</literal> characters. See <link + linkend="ls-imaps-syntax" endterm="ls-imaps-syntax.title"></link> for + a detailed explanation of the <literal>IMAP()</literal> command. + </para> + <para> + For maps which are triggered for a given filetype, the + <literal>IMAP()</literal> command above should be put in the filetype + plugin script for that file. For example, for tex-specific mappings, + the <literal>IMAP()</literal> calls should go in + <literal>$VIM/ftplugin/tex.vim</literal>. For globally visible maps, + you will need to use the following in either your + <literal>~/.vimrc</literal> or a file in your + <literal>$VIM/plugin</literal> directory. + <programlisting>augroup MyIMAPs + au! + au VimEnter * call IMAP('Foo', 'foo', '') +augroup END</programlisting> + </para> + <section id="why-IMAP"> + <title id="why-IMAP.title">Why use <literal>IMAP()</literal></title> + <para> + Using <literal>IMAP</literal> instead of &vim;'s built-in + <literal>:imap</literal> command has a couple of advantages: + <orderedlist> + <listitem> + The 'ttimeout' option will generally limit how easily you can type + the left hand side for a normal <literal>:imap</literal>. if you type + the left hand side too slowly, then the mapping will not be + activated. + </listitem> + <listitem> + If you mistype one of the letters of the lhs, then the mapping is + deactivated as soon as you backspace to correct the mistake. + </listitem> + <listitem> + The characters in lhs are shown on top of each other. This is fairly + distracting. This becomes a real annoyance when a lot of characters + initiate mappings. + </listitem> + </orderedlist> + </para> + </section> + <section id="ls-imaps-syntax"> + <title id="ls-imaps-syntax.title">IMAP() syntax</title> + <para> + Formally, the syntax which is used for the <literal>IMAP</literal> + function is: + <programlisting>call IMAP (lhs, rhs, ft [, phs, phe])</programlisting> + </para> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Argument</entry> + <entry>Explanation</entry> + </row> + </thead> + <tbody> + <row> + <entry>lhs</entry> + <entry> + <para> + This is the "left-hand-side" of the mapping. When you use + <literal>IMAP</literal>, only the last character of this word is + actually mapped, although the effect is that the whole word is + mapped. + </para> + <para> + If you have two mappings which end in a common + <literal>lhs</literal>, then the mapping with the longer + <literal>lhs</literal> is used. For example, if you do + <programlisting>call IMAP('BarFoo', 'something', 'tex') +call IMAP('Foo', 'something else', 'tex')</programlisting> + Then typing <literal>BarFoo</literal> inserts + <literal>"something"</literal>, whereas <literal>Foo</literal> by + itself inserts <literal>"something else"</literal>. + </para> + <para> + Also, the nature of <literal>IMAP()</literal> makes creating + certain combination of mappings impossible. For example if you + have + <programlisting>call IMAP('foo', 'something', 'tex') +call IMAP('foobar', 'something else', 'tex')</programlisting> + Then you will never be able to trigger <literal>"foobar"</literal> + because typing <literal>"foo"</literal> will immediately insert + <literal>"something"</literal>. This is the "cost" which you incur + over the normal <literal>:imap</literal> command for the + convenience of no 'timeout' problems, the ability to correct + <literal>lhs</literal> etc. + </para> + </entry> + </row> + <row> + <entry>rhs</entry> + <entry> + <para> + The "right-hand-side" of the mapping. This is the expansion you + will get when you type <literal>lhs</literal>. + </para> + <para> + This string can also contain special characters such as + <literal><enter></literal> etc. To do this, you will need + to specify the second argument in double-quotes as follows: + <programlisting>:call IMAP('EFE', "\\begin{figure}\<CR>&ph;\\end{figure}&ph;", 'tex')</programlisting> + With this, typing <literal>EFE</literal> is equivalent to typing + in the right-hand side with all the special characters in + insert-mode. This has the advantage that if you have filetype + indentation set up, then the right hand side will also be + indented just as if you had typed it in normally. + </para> + <anchor id="IMAP_PutTextWithMovement" /> + <para> + You can also set up a &ls; style mapping which calls a custom function + as follows: + <programlisting>:call IMAP('FOO', "\<C-r>=MyFoonction()\<CR>", 'tex')</programlisting> + where <literal>MyFoonction</literal> is a custom function you have + written. If <literal>MyFoonction</literal> also has to return a string + containing <literal>&ph;</literal> characters, then you will need to + use the function <literal>IMAP_PutTextWithMovement()</literal>. An + example best explains the usage: + </para> + <programlisting>call IMAP('FOO', "\<C-r>=AskVimFunc()\<CR>", 'vim') +" Askvimfunc: Asks For Function Name And Sets Up Template +" Description: +function! AskVimFunc() + let name = input('Name of the function : ') + if name == '' + let name = "<+Function Name+>" + end + let islocal = input('Is this function scriptlocal ? [y]/n : ', 'y') + if islocal == 'y' + let sidstr = '<SID>' + else + let sidstr = '' + endif + return IMAP_PutTextWithMovement( + \ "\" ".name.": <+short description+> \<cr>" . + \ "Description: <+long description+>\<cr>" . + \ "\<C-u>function! ".name."(<+arguments+>)&ph;\<cr>" . + \ "<+function body+>\<cr>" . + \ "endfunction \" " + \ ) +endfunction</programlisting> + <para> + </para> + </entry> + </row> + <row> + <entry>ft</entry> + <entry> + <para> + The file type for which this mapping is active. When this string + is left empty, the mapping applies for all file-types. A filetype + specific mapping will always take precedence. + </para> + </entry> + </row> + <row> + <entry>phs, phe</entry> + <entry> + <para> + If you prefer to write the <literal>rhs</literal> with characters + other than <literal><+</literal> and <literal>+></literal> + to denote place-holders, you can use the last 2 arguments to + specify which characters in the <literal>rhs</literal> specify + place-holders. By default, these are <literal><+</literal> and + <literal>+></literal> respectively. + </para> + <para> + Note that the <literal>phs</literal> and <literal>phe</literal> + arguments do not control what characters will be displayed for + the placeholders when the mapping is actually triggered. What + characters are used to display place-holders when you trigger an + <literal>IMAP</literal> are controlled by the <link + linkend="Imap_PlaceHolderStart"><literal>Imap_PlaceHolderStart</literal></link> + and <link + linkend="Imap_PlaceHolderEnd"><literal>Imap_PlaceHolderEnd</literal></link> + settings. + </para> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </section> + </section> + </section> + <section id="latex-packages"> + <title>Package Handling</title> + <para> + &ls; has a lot of functionality written to ease working with packages. + Packages here refers to files which you include into the &latex; + document using the <literal>\usepackage</literal> command. + </para> + <section id="inserting-packages"> + <title>Inserting package commands</title> + <para> + When you first invoke &ls;, it scans the + <literal>$VIM/ftplugin/latex-suite/packages</literal> directory for + package script files and creates a menu from all the files found there. + This menu is created under <literal>TeX-Suite > Packages > + Supported</literal>. This menu contains a list of packages "supported" + by &ls;. When you choose one of the packages from this menu (for example + the <literal>amsmath</literal> package), then a line of + the form + <programlisting>\usepackage[&ph;]{amsmath}&ph;</programlisting> + will be inserted into the current file. + </para> + <para> + The <literal>\usepackage</literal> line can also be inserted in an easy + manner in the current file by pressing <literal><F5></literal> + while in the preamble of the current document. This will set up a prompt + from the supported packages and ask you to choose from one of them. If + you do not find the package you want to insert in the list, you can type + in a package-name and it will use that. Pressing + <literal><F5></literal> in the preamble on a line containing a + single word will construct a <literal>\usepackage</literal> line from + that word. + </para> + <para> + You can also use the <link + linkend="TPackage"><literal>TPackage</literal></link> to insert the + <literal>\usepackage</literal> line. + </para> + <para> + Once you have inserted a <literal>\usepackage</literal> line, for + supported packages, you can use the Options and Commands menus + described in the <link linkend="package-actions">next section</link>. + </para> + </section> + <section id="package-actions"> + <title>Actions taken for supported packages</title> + <para> + &ls; takes the following actions for packages detected when a file is + loaded, or a new <literal>\usepackage</literal> line is inserted using + one of the methods described in the <link + linkend="inserting-packages">previous section</link>. + </para> + <para> + If you are using the GUI and you have <link + linkend="Tex_Menus">g:Tex_Menus</link> set to 1, &ls; will create the + following sub-menus + <simplelist> + <member><literal>TeX-Suite > Packages > <package> Options</literal></member> + <member><literal>TeX-Suite > Packages > <package> Commands</literal></member> + </simplelist> + </para> + <para> + where <literal><package></literal> is the package you just + inserted (or was detected). You can use these menus to insert commands, + environments and options which &ls; recognizes as belonging to this + package. + </para> + <note> + <para> + While inserting an option, you need to position yourself in the + appropriate place in the document, most commonly inside the square + braces in the <literal>\usepackage[]{packname}</literal> command. &ls; + will not navigate to that location. + </para> + </note> + <para> + In addition to creating these sub-menus, &ls; will also scan the + <literal>$VIM/ftplugin/latex-suite/dictionaries</literal> directory and + if a dictionary file corresponding to the package file is found, then + it will add the file to the <literal>'dict'</literal> setting in &vim; + so you can use the <literal><C-X><C-K></literal> command to + complete words from that file. + </para> + <para> + For example, the <literal>SIUnits</literal> package has a custom + dictionary. + </para> + <anchor id="latex-package-scanning" /> + <para> + If a package detected at startup is found by &ls; in the current + directory or in a location specified by the <link + linkend="Tex_TEXINPUTS">g:Tex_TEXINPUTS</link> variable, &ls; will + scan the package for <literal>\newenvironment</literal> and + <literal>newcommand</literal> lines and also append any commands and + environments found to the list of commands and environments which you + are prompted with when you press <link + linkend="inserting-env-f5"><literal><F5></literal></link> or <link + linkend="ls-imap-f7"><literal><F7></literal></link> in insert + mode. + </para> + </section> + <para> + In addition, the <literal>TeX-Suite > Packages</literal> menu also + contains the following submenus + </para> + <formalpara> + <title>Update</title> + This command is to be invoked with the cursor placed on the package + name. If the corresponding package is found, then a sub-menu with the + supported commands and options is created. + </formalpara> + <formalpara> + <title>Update All</title> + This function reads the preamble of the document for + <literal>\usepackage</literal> lines and if &ls; supports the detected + packages, then sub-menus containing the package options and commands + are created. + </formalpara> + <section id="automatic-package-detection"> + <title>Automatic Package detection</title> + <para> + Whenever &ls; begins editing a new &latex; file, it scans it for + <literal>\usepackage{name}</literal> lines, and if a supported package + is found, then it will create sub-menus and add to the + <literal>'dict'</literal> setting as described above. + </para> + <para> + If a <link linkend="latex-master-file">master-file</link> has been specified, + then it will scan that file instead of the current file. See the section + <link linkend="custom-packages">Custom Packages</link> + to see which files &ls; will scan in more detail. + </para> + <para> + For all the packages detected in this manner, &ls; will take certain + actions as described in the section <link + linkend="package-actions">package support.</link>. + </para> + <section id="custom-packages"> + <title>Custom Packages</title> + <para> + Often times, the preamble can become too long, and some people prefer + to put most of their personalization in a custom package and include + that using a <literal>\usepackage</literal> line. &ls; tries to search + such customs package for other <literal>\usepackage</literal> lines, so + that supported packages included in this indirect manner can also be + used to create sub-menus, extend the <literal>'dict'</literal> setting + etc. The most obvious place to place such custom packages is in the + same directory as the edited file. In addition, &latex; also supports + placing custom packages in places pointed to by the + <literal>$TEXINPUTS</literal> environment variable. + </para> + <para> + If you use the <literal>$TEXINPUTS</literal> variable in &latex;, and + you wish &ls; to search these custom packages for + <literal>\usepackage</literal> lines, then you need to initialize the + <link linkend="Tex_TEXINPUTS"><literal>g:Tex_TEXINPUTS</literal></link> + variable. + </para> + <para> + The <literal>g:Tex_TEXINPUTS</literal> variable needs to be set in the + same format which &vim; uses for the <literal>'path'</literal> setting. + This format is explained in detail if you do + <programlisting>:help file-searching</programlisting> + from within &vim;. + </para> + <para> + Therefore the value of <literal>g:Tex_TEXINPUTS</literal> will most + probably be different from <literal>$TEXINPUTS</literal> which your + native &latex; distribution uses. + </para> + <para> + Example: + <programlisting>let g:Tex_TEXINPUTS = '~/texmf/mypackages/**,./**'</programlisting> + The <literal>**</literal> indicates that all directories below the + directory <literal>~/texmf/mypackages</literal> and + <literal>./</literal> are to be scanned for custom packages. + </para> + <note> + <para> + The present directory <literal>'.'</literal> is always searched. You + need not include that in <literal>g:Tex_TEXINPUTS</literal>. + </para> + </note> + </section> + </section> + <section id="supporting-packages"> + <title>Writing supporting for a package</title> + <para> + Supporting a package is easy and consists of writing a vim script with + the same name as the package and placing it in the + <literal>$VIM/ftplugin/latex-suite/packages</literal> directory. A + package script should define two variables as described in the next two + sections. In addition to these two variables, you can also define any + functions, environment definitions etc. in this file. + </para> + <section> + <title><literal>g:Tex_package_option_<package></literal></title> + <para> + This setting is a string containing a comma separated list of options + supported by this package. + </para> + <para> + Example: + <programlisting>g:Tex_package_option_mypack = 'opt1,opt2=,sbr:group1,opt3,opt4'</programlisting> + The <literal>=</literal> suffix means that the option takes a value. + Use <literal>sbr:group name</literal> to separate options into + sub-menus. All successive options will be clubbed into the + <literal>group1</literal> sub-menu till the next + <literal>sbr:</literal> option is encountered. + </para> + </section> + <section> + <title><literal>g:Tex_package_<package></literal></title> + <programlisting> + g:TeX_package_<package> = "pre:Command,pre:Command1" +More detailed example is in latex-suite/packages/exmpl file (slightly +outdated). +Here is short summary of prefixes which can be used in package files: +(x - place with cursor, &ph; - |placeholder|) + +{env:command} Environment: creates simple environment template + \begin{command} + x + \end{command}&ph; +{eno:command} Environment with option: + \begin[x]{command} + &ph; + \end{command}&ph; +{ens:command[<<option>>]...} Environment special: + \begin[<<option>>]...{command} + &ph; + \end{command}&ph; +{bra:command} Brackets: + \command{x}&ph; +{brd:command} Brackets double: + \command{x}{&ph;}&ph; +{brs:command[<<option>>]...} Brackets special (as environment special: + \command[<+x+>]{&ph;}{&ph;}&ph; +{nor:command} Normal: + \command<Space +{noo:command} Normal with option: + \command[x]&ph; +{nob:command} Normal with option and brackets: + \command[x]{&ph;}&ph; +{pla:command} Plain: + command<Space +{spe:command} Special: + command <-literal insertion of command +{sep:command} creates separator. Good for aesthetics and usability :) +{sbr:command} Breaks menu into submenus. <command> will be title of submenu. + Can be used also in package variable. + +Command can be also given without prefix:. The result is + \command + </programlisting> + </section> + </section> + </section> + <section id="latex-completion"> + <title>Latex Completion</title> + <para> + &ls; provides an easy way to insert references to labels and + bibliographic entries and also provide filename arguments to commands + such as <literal>\includegraphics</literal>. Although the completion + capabilities are very diverse, &ls; only uses a single key + (<literal><F9></literal> by default) to do all of it. Pressing the + <literal><F9></literal> key does different things based on where + you are located. &ls; tries to guess what you might be trying to + complete at the location where you pressed + <literal><F9></literal>. For example, pressing + <literal><F9></literal> when you are within a + <literal>\ref</literal> command will try to list the + <literal>\label</literal>'s in the present directory. Pressing it when + you are in a <literal>\cite</literal> command will list bibliography + keys. &ls; also recognizes commands which need a file name argument and + will put up an explorer window for you to choose a filename. + </para> + <note id="ls-set-grepprg"> + <title>Before you start with &ls;'s completion function...</title> + <para> + All of &ls;'s completion capabilities depend on a external program + being available on your system which can search through a number of + files for a reg-exp pattern. On *nix systems, the pre-installed + <literal>grep</literal> utility is more than adequate. Most windows + systems come with a utility <literal>findstr</literal>, but that has + proven to be very inadequate (for one, it does not have an option to + force the file name to be displayed when searching through a single + file). Your best bet is to install <ulink + url="http://www.cygwin.com">cygwin</ulink>, but if you think that's + overkill, you can <ulink + url="http://www.google.com/search?q=windows%20gnu%20grep">search + for</ulink> a windows implementation of GNU grep. (&ls; testing on + windows has been done with cygwin's port of GNU grep). + </para> + <para> + Once you have a <literal>grep</literal> program installed, you need to + set the <literal>'grepprg'</literal> option for vim. Make sure you use a + setting which forces the program to display file names even when you are + searching through a single file. For GNU grep, the syntax is + <programlisting>set grepprg=grep\ -nH\ $*</programlisting> + </para> + </note> + <section id="ls-completion-usage"> + <title id="ls-completion-usage.title">&ls; completion example</title> + <para> + Consider the situation where you are editing a file with two equations + labelled <literal>eqn:euler</literal> and <literal>eqn:einstein</literal>. + Now you want to insert a reference to one of these equations. To do this, + you type the <literal>\ref{eqn:}</literal> command and with the cursor + placed after <literal>eqn:</literal>, press <literal><F9></literal>. + This will bring up two new windows beneath the main window you were working + in as shown in the figure below. + <programlisting> + 8 These are a couple of equations: + 9 +-- 4 lines: eqnarray (eqn:euler) : e^{j\pi} + 1 &=& 0--------------- + 13 +-- 4 lines: equation (eqn:einstein) : E = m c^2--------------------- + 17 + 18 These are a couple of figures: + 19 +-- 7 lines: figure (fig:monkeys) : Monkeys can Type------------------- + 26 +-- 7 lines: figure (fig:shakespeare) : Shakespeare could not type----- + 33 + 34 This is a reference to \ref{eqn:}&ph; + 35 + 36 + 37 \end{document} + 38 +~ +~ +~ +newfile.tex 34,32 Bot +newfile.tex|11| \label{eqn:euler} +newfile.tex|15| \label{eqn:einstein} +~ +[Error List] 1,1 All + 7 + 8 These are a couple of equations: + 9 \begin{eqnarray} + 10 e^{j\pi} + 1 &=& 0 + 11 \label{eqn:euler} + 12 \end{eqnarray} + 13 \begin{equation} + 14 E = m c^2 + 15 \label{eqn:einstein} + 16 \end{equation} +newfile.tex [Preview] 11,3 21% + </programlisting> + </para> + <para> + The first window (shown as <literal>[Error List]</literal> above) is a + <literal>|cwindow|</literal> containing a list of possible matches for the + reference. The cursor will be located in the first line of this window. The + bottom window is a <literal>preview-window</literal> showing the context of + the <literal>\label</literal>. Moving around in the + <literal>[Error List]</literal> window automatically scrolls the + preview window so as to always keep showing the context of the + <literal>\label</literal> being viewed in the + <literal>[Error List]</literal> window. You can also press + <literal>J</literal> and <literal>K</literal> in the + <literal>[ErrorList]</literal> window to scroll the preview window up and + down. + </para> + <para> + To insert one of the labels, simply position the cursor in the correct line + in the <literal>[Error List]</literal> window and press + <literal><enter></literal>. This will immediately close the two newly + opened windows, get back to the correct location in the original file being + edited and insert the label into the <literal>\ref</literal> command. + </para> + <para> + If you notice carefully in the example above, the + <literal>[Error List]</literal> window only showed the matches for the + equations and did not list any of the figure labels. This is because we + pressed <literal><F9></literal> after <literal>\ref{eqn:</literal> + instead of simply after <literal>\ref{</literal>. This caused &ls; to + search only for those labels which started with the string + <literal>eqn:</literal>. If you had pressed + <literal><F9></literal> after a <literal>\ref{</literal>, you would + have been shown matches from <emphasis>all</emphasis> labels, not just + those starting with <literal>eqn:</literal>. + </para> + <para> + Thus prefixing all your labels with <literal>eqn:</literal>, + <literal>fig:</literal>, <literal>tab:</literal> etc. depending on what you + are labelling will lead to an easier time completing references. + </para> + </section> + <section id="ls-completion-ref"> + <title>&ls; \ref completion</title> + <para> + Pressing <literal><F9></literal> when you are within a partially + completed <literal>\ref</literal> command will split open a window + (named <literal>__OUTLINE__</literal>) which contains a nicely + formatted list of all the <literal>\label</literal>s found in the + present project. The <literal>\label</literal>s are heirarchically + arranged according to which <literal>\section</literal>, + <literal>\subsection</literal> etc of the overall document structure + they are present in. For example, when you first press + <literal><F9></literal> after typing <literal>\ref{</literal>, + you should see something like: + <programlisting> ++-- 54 lines: 2. Kinematics-------------------------------- ++-- 98 lines: 3. Aerodynamics of the MFI thorax------------ ++-- 40 lines: 4. Jump Resonance in Fourbar Mechanisms------ ++-- 28 lines: 5. Design and Fabrication Issues------------- + </programlisting> + Each chapter is |fold|ed away so that you can quickly jump to the + correct section/subsection in which the relevant equation is defined. + This makes inserting references significantly faster for large projects + with hundreds of equations. You can then open some of the folds to see + for example: + <programlisting> ++-- 54 lines: 2. Kinematics-------------------------------- +3. Aerodynamics of the MFI thorax + 3.1. Aerodynamic modeling of the MFI wing forces + 3.1.1. Geometric Specification + eqn:wingnormal-pos + \nhat = T_z(\theta_2) T_y(\theta_y)T_x(\theta_x)\nhat_0, + eqn:T-1 + T_1(\theta_2) &=& T_z(\theta_2) + </programlisting> + The <literal><Tab></literal> key is mapped in this window to + toggle folds so that you can quickly open/close folds in order to + navigate the heirarchy faster. Once you are positioned on a + label, press <literal><Enter></literal>. This closes the + <literal>__OUTLINE__</literal> window, returns to the window in which + you pressed <literal><F9></literal> and inserts the reference + at the current cursor position. + </para> + <note> + <title>Filtering labels by prefix</title> + <para> + You can press <literal><F9></literal> after typing part of the + <literal>\label</literal>. In this case, &ls; only presents + <literal>\label</literal>s which begin with the already filled + characters. You can use this to choose between equations, figures, + tables etc. if you consistently label equations to begin with + <literal>eqn:</literal>, figures to begin with <literal>fig:</literal> + etc. For example, with this scheme, pressing + <literal><F9></literal> after typing + <literal>\ref{eqn:</literal> will only list equations. + </para> + </note> + <note> + <para> + &ls; works the same way if you press <literal><F9></literal> + after any command which contains the letters <literal>ref</literal>. + Thus you can complete <literal>\eqref</literal> in exactly the same + manner. + </para> + </note> + <note> + <title>Requirements</title> + <para> + This method of preseting the <literal>\label</literal>s depends on Vim + being compiled with python support. To check if you have this, see the + output of the <literal>:ver</literal> command. If you see something + like <literal>+python</literal>, you are all set. Failing this, you + will need to have <literal>python</literal> somewhere in your + <literal>$PATH</literal>. + </para> + </note> + </section> + <section id="latex-completion-cite"> + <title>&ls; <literal>\cite</literal> completion</title> + <para> + &ls; provides an easy way to insert references to bibliographic + entries. Pressing <literal><F9></literal> when the cursor is + placed inside a partially completed <literal>\cite</literal> command + will split open a new window (named <literal>__OUTLINE__</literal>) + which contains a formatted and syntax highlighted list of all bibtex + entries found. For example, pressing <literal><F9></literal> + after typing <literal>\ref{</literal> should present you with a window + which looks something like this: + <programlisting> +Article [dickinson:science:99] + "Wing rotation and aerodynamic basis of insect flight" + M. H. Dickinson and F-O. Lehman and S. P. Sane + In Science, 1999 + +Article [ellington:84:part1] + "The Aerodynamics of Hovering Insect Flight. I. The Quasi-Steady Analysis" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + +Article [ellington:84:part2] + "The Aerodynamics of Hovering Insect Flight. II. Morphological Parameters" + Ellington, C P + In Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences, 1984 + </programlisting> + </para> + <para> + You can easily jump from one entry to another using the + <literal>'n'</literal> and <literal>'p'</literal> keys (to go to the + next / previous entry respectively). + </para> + <para> + You can also filter out a subset of the bibtex entries by pressing + <literal>'f'</literal> while in this window. Doing this presents the + following prompt: + <programlisting> +Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message) + [t] title [a] author [b] booktitle + [j] journal [y] year [p] bibtype + (you can also enter the complete field name) +Enter filter criterion [field<space>value]: + </programlisting> + At the prompt, type + <programlisting>a ellington</programlisting> + Notice that the letter a is an acronym for <literal>author</literal> + according to the prompt above. Therefore this filter only shows those + bibtex entries whose author field contains the text + <literal>ellington</literal>. You can keep narrowing your selection by + repeatedly filtering the results. If you would like to remove all the + filters and see all entries again, press 'a', which removes + all the filters. + </para> + <para> + You can also sort the bibtex entries based on a field. To do this, + press 's'. This will present you with a prompt like in the case of the + filter and you are asked to choose a field. In this case, you would + type in a single character. This sorts the entries according to that + field. + </para> + <note> + <para> + <literal><F9></literal> will also work in a similar way after any + command which contains the word <literal>cite</literal> in it. For + example, pressing <literal><F9></literal> will also work with + <literal>\citenum</literal> etc. + </para> + </note> + <para> + The following logic is applied to find out which bibliographic entries + are included in the completion. + </para> + <orderedlist> + <listitem> + <para> + Firstly, if the present file has a <link + linkend="latex-master-file">master-file</link> defined for it, then &ls; + will perform the following steps on that file instead of on the + current file. + </para> + </listitem> + <listitem> + <para> + First, the file is scanned for a <literal>\bibliography</literal> + command. To explain better, assume that a command + <programlisting>\bibliography{file1,file2}</programlisting> is found + in the present file. For each bibliography file, say + <literal>file1</literal>, &ls; first tries to see if a + <literal>.bib</literal> file, <literal>file1.bib</literal> can be + found. If so, it will scan it for bib-keys of the form + <literal>@BOOK{</literal> etc., and add these searches to the + completion list. If a <literal>.bib</literal> file cannot be found, + then it will try to see if <literal>file1.bbl</literal> can be found. + If so, &ls; will search it for bib-keys of the form + <literal>\bibitem</literal> and add these to the completion list. + </para> + <para> + You can set the location where &ls; will search for + <literal>.bib</literal> and <literal>.bbl</literal> files using the + <link + linkend="Tex_BIBINPUTS"><literal>|Tex_BIBINPUTS|</literal></link> + variable. + </para> + </listitem> + <listitem> + <para> + If a <literal>\bibliography</literal> command is not found, then &ls; + tries to scan the present file for a + <literal>\begin{thebibliography}</literal> environment. If found, + &ls; searches the present file for bib-keys of the form + <literal>\bibitem</literal>. + </para> + </listitem> + <listitem> + <para> + Finally, it will try to see if this file includes other files + via the <literal>\input</literal> command. For each such file found, + &ls; will repeat the previous two steps stopping at the first file + which has either a <literal>\bibliography</literal> command or a + <literal>thebibliography</literal> environment. + </para> + </listitem> + </orderedlist> + <section id="cite-search-caching"> + <title>Caching the <literal>\cite</literal> completion results</title> + <anchor id="TClearCiteHist"></anchor> + <para> + Often times, the editing cycle proceeds by first laying out a + comprehensive bibliography and then completing all the + <literal>\cite</literal> commands in one session. In such situations, + it is inefficient to scan the whole list of bibliography files for + bib-keys each time. &ls; provides a way to cache the results of the + cite completion search using the <link + linkend="Tex_RememberCiteSearch"><literal>Tex_RememberCiteSearch</literal></link> + variable. If set, &ls; will perform the search only the first time + <literal><F9></literal> is used. Next time on, it will reuse the + search results. If you wish to redo the search results, issue the + command + <programlisting>TClearCiteHist</programlisting> + This will redo the completion list next time you use + <literal><F9></literal>. + </para> + </section> + </section> + <section id="ls-filename-completion"> + <title>&ls; filename completion</title> + <para> + When you press <literal><F9></literal> at a location where &ls; + guesses a filename needs to be typed, then a new explorer window will + open up with the list of files. You can use this window to change + directories etc. Pressing <literal><enter></literal> on a filename + in the explorer window will automatically close the explorer window, + return to the location where you pressed <literal><F9></literal> + from and insert the filename into that position. + </para> + <para> + &ls; also tries to guess what kinds of files you might not want to + insert and hides those accordingly. For example, if you press + <literal><F9></literal> when you are located at + <literal>\includegraphics{</literal>, then &ls; knows that you will not + want to insert <literal>.tex</literal> files. Therefore, the explorer + window will automatically hide these files. + </para> + <para> + As of now, &ls; recognizes the following commands for filename + completion. Along with the commands, this table also lists the + files which &ls; will not show for completing each command. + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>command</entry> + <entry>hide pattern</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>\bibliography</literal></entry> + <entry><literal>'^\.,\.[^b]..$'</literal></entry> + </row> + <row> + <entry><literal>\include</literal> <literal>\includeonly</literal></entry> + <entry><literal>'^\.,\.[^t]..$'</literal></entry> + </row> + <row> + <entry><literal>\includegraphics</literal> <literal>\psfig</literal></entry> + <entry><literal>'^\.,\.tex$,\.bib$,\.bbl$,\.zip$,\.gz$'</literal></entry> + </row> + <row> + <entry><literal>\input</literal></entry> + <entry><literal>''</literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + <section id="ls-completion-custom"> + <title>Custom command completion</title> + <para> + &ls; also recognizes certain commonly used &latex; commands for the + <literal><F9></literal> key. At the moment, the + <literal>\bibliographystyle</literal>, <literal>\addtocontents</literal> + and the <literal>\addcontentsline</literal> commands are recognized, + although more will be added in the future. When you press the + <literal><F9></literal> after such a command, &ls; will prompt + you with a list of arguments which make sense for the command. + </para> + <para> + This functionality is available for commands for which a global + variable of the form + <literal>g:Tex_completion_{<command>}</literal> is defined where + <literal><command></literal> is the command name. This variable + is a comma separated list of values which this command takes. For + example, the argument to the <literal>\bibliographystyle</literal> + command is commonly one of <literal>abbr,alpha,plain,unsrt</literal>. + Therefore, &ls; defines + <programlisting>let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt'</programlisting> + You can define your own completion variables in a similar manner for + commands which you might use. + </para> + </section> + </section> + <section id="latex-compiling"> + <title>&latex; Compiling</title> + <para> + This functionality, available via the TeX-Suite menu, provides various tools + to compile and debug &latex; files from within &vim;. + </para> + <para> + If you are using commonly used LaTeX tools, then you should be all set + as soon as you download and install &ls;. In order to compile a + LaTeX file, simply press <literal>\ll</literal> while editing the file. + This runs latex on the current file and displays the errors in a + |quickfix-window| below the file being edited. You can then scroll + through the errors and press <literal><enter></literal> to be + taken to the location of the corresponding error. Along with the errors + being listed in the quickfix window, the corresponding log file is also + opened in |preview| mode beneath the quickfix window. It is scrolled + automatically to keep in sync with the error being viewed in the + quickfix window. You will be automatically taken to the location of the + first error/warning unless you set the <link + linkend="Tex_GotoError">g:Tex_GotoError</link> variable to 0. + </para> + <para> + &ls; also supports compiling &latex; into formats other than DVI. By + default, &ls; supports PDF and PS formats. In order to choose a format + other than DVI, use the <literal>TTarget</literal> command or the + <literal>TeX-Suite > Target Format</literal> menu item. This will ask you + to type in the name of the target format you want to compile to. If a rule + has been defined for the format (as described in the next + <link linkend="compiler-rules">section</link>), then &ls; will switch to + that format. + </para> + <para>Trying to choose a format for which no rule has been defined will + result in &ls; displaying a warning message without taking any action. + </para> + <para> + If you are using a multiple file project and need to compile a master + file while editing other files, then &ls; provides a way to specify the + file to be compiled as described in <link + linkend="latex-master-file">latex-master-file</link>. + </para> + <section id="compiler-rules"> + <title>Setting Compilation rules</title> + <para> + In order to compile &latex; files into various formats, &ls; needs to know + which external programs to call and in which way they need to be called. + This information is provided to &ls; via a number of "rules". For each + format you want to compile to, you need to specify a rule. A rule is + specified by defining a variable of the form: + <programlisting>g:Tex_CompileRule_<format></programlisting> + where <literal><format></literal> is a string like + <literal>"pdf"</literal>, <literal>"dvi"</literal> etc. + </para> + <para> + Example: By default, &ls; uses the following rule for compiling &latex; + documents into DVI. + <programlisting>g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*'</programlisting> + </para> + <para> + Default values are also provided for ps and pdf formats. You might want to + change these rules in texrc according to your local tex environment. + </para> + <note> + <para> + For win32 users user MikTeX, sometimes the latex compiler's output has a + bug where a single number is split across different lines. In this case, + put the included <literal>vim-latex</literal> file distributed with &ls;. + </para> + </note> + </section> + <section id="compiler-dependency"> + <title>Handling dependencies in compilation</title> + <para> + &ls; also handles compiling dependencies automatically via certain + rules which specify the "dependency chain" for each target format. + For example, if in your case, you use + <programlisting>.tex -> .dvi -> .ps -> .pdf</programlisting> + to generate <literal>pdf</literal> files from <literal>dvi</literal> + files, then you will need to specify the following setting in your + &ls; configuration (see <link + linkend="customizing-latex-suite">customizing &ls;</link> for where + these settings should go): + <programlisting> +let g:Tex_FormatDependency_pdf = 'dvi,ps,pdf' +</programlisting> + This is a comma separated string of formats specifying the order in + which the formats to be compiled into should be chosen. With this + setting, if you set the target format to <literal>pdf</literal>, then + the next time you compile via the <literal>\ll</literal> shortcut, &ls; + will first generate a <literal>dvi</literal> file, then use that to + generate the <literal>ps</literal> file and finally create the + <literal>pdf</literal> file from that. + </para> + <note> + <para> + If any of the intermediate formats is listed in the + <literal>g:Tex_MultipleCompileFormats</literal> setting as described + in the section <link linkend="compiling-multiple">Compiling multiple + times</link>, then &ls; might make multiple calls to the compiler to + generate the output file of that format. + </para> + </note> + <para> + Along with the <literal>g:Tex_FormatDependency_{format}</literal> + setting, you should ofcourse specify the rule for compiling to each of + the formats as described in the <link linkend="compiler-rules">previous + section</link>. For example, with the setting above, you could use: + <programlisting> +let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' +let g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' +let g:Tex_CompileRule_pdf = 'ps2pdf $*.ps'</programlisting> + </para> + <note> + <para> + By default, &ls; does not specify any compiler dependencies. Each + target format for which a rule has been derived will be compiled + independently. + </para> + </note> + </section> + <section id="compiling-multiple"> + <title>Compiling multiple times</title> + <para> + Most &latex; compilers need to be re-run several times in several + commonly occurring situations in order to get a final camera ready copy. + For example, when <literal>\label</literal>'s change, when new + <literal>\cite</literal> commands are added etc. If the target format + you are compiling to requires multiple compilations, then you will + need to include the format in the + <literal>g:Tex_MultipleCompileFormats</literal> setting. This is a + comma separated string of formats which need multiple compilations to + be generated correctly. + </para> + <para> + By default, this setting contains just the <literal>dvi</literal> + format. If you use the <literal>pdflatex</literal> compiler to generate + <literal>pdf</literal> files, then you might want to also include + <literal>pdf</literal> into the above setting. + </para> + <para> + For every format included in the + <literal>g:Tex_MultipleCompileFormats</literal> setting described + above, &ls; will use the following logic to generate the file. Note + that although the following description uses <literal>latex</literal> + to refer to the compiler, it could be some other compiler such as + <literal>pdflatex</literal> for generating <literal>pdf</literal> + output. + </para> + <para> + <orderedlist> + <listitem>If there was a <literal>.idx</literal> file, then remember + its contents.</listitem> + <listitem>Run <literal>latex</literal>.</listitem> + <listitem>If the <literal>.idx</literal> file changed due to the latex + compiler, then run <literal>makeindex</literal> to redo the + <literal>.ind</literal> file and then remember to rerun latex. + </listitem> + <listitem> + <para> + If the <literal>.aux</literal> file generated by the latex + compiler contains a <literal>\bibdata</literal> line, then it + means that we are using a <literal>.bib</literal> file. Therefore, + run <literal>bibtex</literal>. + </para> + <note> + <para> + This means that we will always run <literal>bibtex</literal> + whenever we use the <literal>\bibliography</literal> command + whether or not we actually need to. At this time, &ls; does not + parse the <literal>.aux</literal> file before and after the latex + compiler to see if we are required to rerun + <literal>bibtex</literal>. + </para> + </note> + </listitem> + <listitem> + If the <literal>.bbl</literal> file changes because of this, then + remember to rerun latex again. + </listitem> + <listitem>Also, we check to see if the &latex; compiler gives certain + standard warnings which notify that we need to compile once again. In + this case also, remember to rerun &latex;.</listitem> + <listitem>If we found we had to rerun latex, then we repeat + the steps above but not running <literal>makeindex</literal> or + <literal>bibtex</literal> again.</listitem> + </orderedlist> + </para> + <para> + The &latex; file is compiled atmost 5 times using this logic. These + steps will ensure that on most platforms/environments, you will get a + clean output with all the cross-references, citations etc correctly + labelled and ordered. + </para> + </section> + <section id="compiler-output-customization"> + <title>Customizing the compiler output</title> + <para> + Most &latex; compilers produce a very large amount of output during + compilation, most of which is not relevant to debugging type-setting + errors. The compiler plugin provided with &ls; (which is an enhanced + version of the standard compiler plugin maintained by Artem Chuprina), + provides a way to filter the compiler output so that the actual + errors/warnings can be presented much more concisely. + </para> + <para> + The compiler plugin is set up by default to function in a "non-verbose", + "ignore-common-warnings" mode, which means that irrelevant lines from the + compiler output will be ignored and some very common warnings are also + ignored. + &ls; does this via the global variable <link + linkend="Tex_IgnoredWarnings"><literal>g:Tex_IgnoredWarnings</literal></link>. + This is a list of patterns, which can be used to filter out (or ignore) + some or the warnings and errors reported by the compiler. See the link + above for its default value. + </para> + <para> + &ls; uses the <link + linkend="Tex_IgnoreLevel"><literal>g:Tex_IgnoreLevel</literal></link> + setting to set a default ignore level. For example, for the default + value of 4, &ls; ignores warnings and errors matching the first 4 + patterns in <literal>g:Tex_IgnoredWarnings</literal>. + </para> + <para> + In addition to setting a default value of the ignore level, &ls; + provides the ability to set the level dynamically, using the + <literal>TCLevel</literal> command. For example, if you issue the + command: + <programlisting>TCLevel 3</programlisting> + from within &vim;, then the next time you compile the document, &ls; will + ignore warnings and errors which match the first three patterns in + <literal>g:Tex_IgnoredWarnings</literal>. + </para> + <para> + When TCLevel is called with the unquoted string strict as follows: + <programlisting>TClevel strict</programlisting> + then &ls; switches to a "verbose", "no-lines-ignored" mode which is useful + when you want to make final checks of your document and want to be careful + not to let things slip by. + </para> + <para> + See the explanation of the settings <link + linkend="Tex_IgnoredWarnings">g:Tex_IgnoredWarnings</link> and <link + linkend="Tex_IgnoreLevel">g:Tex_IgnoreLevel</link> to find out how to + customize the filtering done by &ls; + </para> + + </section> + <section id="part-compiling"> + <title>Compiling parts of a file</title> + <para> + &ls; also provides a way to compile a fragment of a document. This can be + very useful while debugging a complex equation or one chapter in a book, + etc. + </para> + <para> + To do this, visually select a portion of the text and press + <literal>\ll</literal> while in visual mode. The visually selected portion + will be saved to a temporary file with the preamble from the current + document prepended. &ls; will then switch focus to this temporary file and + compile it. Continue to debug this file as required and then replace the + portion of the original file with this one. + </para> + <para> + Pressing <literal>\lv</literal> while viewing the temporary file will + view the output file generated from the temporary file, not the original + file + </para> + <para> + Two commands |TPartComp| and |TPartView| are provided to be able to get + this functionality via the command line. + </para> + <para> + From release 1.6 onwards of &ls;, the temporary file created + for part compilation will reside in the same directory as the file from + which the fragment is being created. This ensures that any relative + path-names defined in the fragment will still work. &ls; will + attempt to clean the temporary file(s) created when Vim exits. + </para> + </section> + </section> + <section id="latex-viewing"> + <title>Latex Viewing and Searching</title> + <section id="latex-viewing-rules"> + <title>Setting Viewing rules</title> + <para> + In order to view the output files created by compiling the source + files, you need to specify which external program &ls; should call. You + can specify the external program using one of two settings + <link linkend="Tex_ViewRule_format">Tex_ViewRule_format</link> or <link + linkend="Tex_ViewRuleComplete_format">Tex_ViewRuleComplete_format</link>. + By default, &ls; has default settings for viewing various common output + formats via the <literal>Tex_ViewRule_format</literal> settings, so + that if you are using commonly used programs, you should be all set to + view compiled files from within &vim; by simply pressing + <literal>\lv</literal>. + </para> + <note> + <para> + The viewing function also takes the <link + linkend="latex-master-file"><literal>*.latexmain</literal></link> file + into account to decide which file to show. + </para> + </note> + <para> + If pressing <literal>\lv</literal> does not work, then it most probably + has to do with incorrect settings of the <link + linkend="Tex_ViewRule_format"><literal>g:Tex_ViewRule_<format></literal></link> + where <literal><format></literal> is the format you are + attempting to view. See the link above for how to set this according to + your system. + </para> + <note> + <para> + On Windows and OS/X, you can leave the view rule empty to open the document + with the default viewer on your system. On Linux/UNIX systems, you can use + the <literal>xdg-open</literal> command to open the document with the default + viewer. + </para> + </note> + <para> + In addition to viewing the files, &ls; also supports forward and inverse + searching for certain common tools for viewing documents. + See the next few sections for details on forward and inverse searching, + including an overview of viewers. + </para> + </section> + <section id="forward-searching"> + <title>Forward Searching documents</title> + <para> + Forward searching refers to making a viewer display a given document at + a given location from within &vim;. At present, these viewers are known to support + forward searching, but viewers that are not listed here may work, too: + <informaltable frame="all"> + <tgroup cols="3"> + <thead> + <row> + <entry>Viewer</entry> + <entry>OS</entry> + <entry>Supported documents</entry> + <entry>Comment</entry> + </row> + </thead> + <tbody> + <row> + <entry><ulink url="http://skim-app.sourceforge.net/">Skim</ulink></entry> + <entry>Apple / OS X Tiger</entry> + <entry>PDF</entry> + <entry>Supports also inverse searching</entry> + </row> + <row> + <entry><ulink url="http://pdfview.sourceforge.net/">PDFView</ulink></entry> + <entry>Apple / OS X</entry> + <entry>PDF</entry> + <entry>No longer in development, supports also inverse searching</entry> + </row> + <row> + <entry><ulink url="http://www2.ing.unipi.it/~d9615/homepage/texniscope.html">TeXniscope</ulink></entry> + <entry>Apple</entry> + <entry>PDF, DVI</entry> + <entry></entry> + </row> + <row> + <entry><ulink url="http://www.miktex.org/">YAP</ulink></entry> + <entry>Windows</entry> + <entry>DVI, PS</entry> + <entry>ships with MikTex</entry> + </row> + <row> + <entry><ulink url="http://blog.kowalczyk.info/software/sumatrapdf/">Sumatra PDF</ulink></entry> + <entry>Windows</entry> + <entry>PDF</entry> + <entry></entry> + </row> + <row> + <entry><ulink url="http://developer.kde.org/~kdvi/">kdvi</ulink></entry> + <entry>Linux/UNIX</entry> + <entry>DVI</entry> + <entry></entry> + </row> + <row> + <entry><ulink url="http://okular.kde.org/">okular</ulink></entry> + <entry>Linux/UNIX</entry> + <entry>DVI, PDF, PS and many more</entry> + <entry>Included in KDE 4</entry> + </row> + <row> + <entry><ulink url="http://math.berkeley.edu/~vojta/xdvi.html">xdvi</ulink></entry> + <entry>Linux/UNIX</entry> + <entry>DVI</entry> + <entry></entry> + </row> + <row> + <entry><ulink url="http://xdvi.sourceforge.net/">xdvik</ulink></entry> + <entry>Linux/UNIX</entry> + <entry>DVI</entry> + <entry></entry> + </row> + </tbody> + </tgroup> + </informaltable> + + Pressing <literal>\ls</literal> from within &vim; + should make the viewer display the portion of the document where your + cursor is placed. + <note> + <para> + OS/X users need to set the <literal>g:Tex_TreatMacViewerAsUNIX</literal> flag + to <literal>1</literal> and provide a UNIX-like viewrule, that expects as + arguments the document, the linenumber and the sourcefile in this order. + </para> + </note> + </para> + <anchor id="enabling-searching" /> + <note> + <title>Enabling Forward and Inverse Searching</title> + <para> + Most DVI viewers need "source-special" information in order to do + forward (and inverse) searching. This information is embedded in the + <literal>dvi</literal> file if the &latex; source is compiled with the + <literal>--src-specials</literal> option. By default, &ls; does not + supply this argument to the compiler. See the section on + <literal><link + linkend="Tex_CompileRule_format">g:Tex_CompileRule_dvi</link></literal> + to find out how this option can be set. + + For pdf viewers you need to use the <ulink url="http://itexmac.sourceforge.net/pdfsync.html">pdfsync</ulink> + package in your LaTeX document. + </para> + </note> + </section> + <section id="inverse-searching"> + <title>Inverse Searching</title> + <para> + Inverse searching refers to the viewer telling &vim; to display the + &latex; source file at a given location when you double-click in the + viewer window. + </para> + <para> + You will need to <link linkend="enabling-searching">enable + searching</link> in order to use this functionality. + </para> + <para> + You will also need to specify certain settings to the DVI viewer + conveying the syntax which it needs to use to tell &vim; how to display + the source file. In <literal>YAP</literal>, you can set this option in + <literal>View > Options > Inverse Search</literal>. The + <literal>Command Line</literal> field needs to be set as follows: + <programlisting>"C:\Program Files\vim\vim61\gvim" -c ":RemoteOpen +%l %f"</programlisting> + The command <literal>:RemoteOpen</literal> is supplied when you install + &ls;. + </para> + <para> + On *nix machines, &ls; attempts to call the DVI viewer in such a way + that it already knows how to communicate with &vim;. If this does not + seem to be working, you can use the <literal>RemoteOpen</literal> + command described above. + </para> + </section> + </section> + <section id="latex-folding"> + <title>Latex Folding</title> + <para> + &ls; ships with the plugin SyntaxFolds.vim which is a plugin for + creating "fake" syntax folds on the fly. The fold method is actually manual + but the folding is based on &latex; syntax. This offers a speed increase over + regular syntax folding. Ofcourse it has the disadvantage that the folds are + not dynamic, i.e newly created syntax items are not automatically folded up. + (This is a compromise between speed and convenience). + </para> + <para> + When you open up a LaTeX file, all the portions will be automatically folded + up. However, no new folds will be created until you press + <literal><F6></literal> or <literal>\rf</literal>. (rf + stands for "refresh folds"). + </para> + <para> + The fold-text is set to the first line of the folded text unless the fold is a + table, figure etc. (an environment). In this case, if a \caption and/or a + label is found in the folded region, then those are used to make a more + meaningful fold-text, otherwise the second line of the environment is displayed + along with the name of the environment. In other words, the following + <programlisting>\begin{figure}[h] + \centerline{\psfig{figure=slidercrank.eps,height=6cm}} + \caption{The Slider Crank Mechanism.} + \label{fig:slidercrank} +\end{figure} +% a LaTeX comment. +\begin{eqnarray} + \sin(\pi) = 0 +\end{eqnarray}</programlisting> + </para> + <para> + will be shown as: + <programlisting>+--- 5 lines: figure (fig:slidercrank) : The Slider Crank Mechanism. ----- +% a LaTeX comment. ++--- 3 lines: eqnarray () : \sin(\pi) = 0 --------------------------------</programlisting> + </para> + <section id="default-folding"> + <title>Default Folding Scheme in &ls;</title> + <para> + By default &ls; creates folds in the following manner: + </para> + <programlisting>\chapter +\section +%%fakesection + \subsection + \subsubsection + \item + \equation + \eqnarray + \figure + \table + \footnote</programlisting> + <para> + The indentation shows the "nestedness" of the folding scheme. + See the <link linkend="customizing-what-to-fold">next section</link> to + see how you can change this scheme. + </para> + </section> + <section id="customizing-what-to-fold"> + <title>Customizing what to fold</title> + <para> + From version 1.6 onwards, the folding in &ls; can be controlled + to a large extent via a number of global variables. + </para> + <section id="Tex_FoldedSections"> + <title>Tex_FoldedSections</title> + <para> + This entry defines which sections will be folded. This + setting is a comma separated list of section names. + The default value is: + <programlisting>part,chapter,section,%%fakesection, +subsection,subsubsection,paragraph</programlisting> + Each of the entries in the list will fold up a section of the + corresponding name. The <literal>%%fakesection</literal> section is + provided as a means for the user to group lines into "fake" sections. + A <literal>%%fakesection</literal> is assumed to start on a line which + begins with the string <literal>%%fakesection</literal> and continue + till the start of the next <literal>\section</literal>, + <literal>\subsection</literal> or any other section. + </para> + <para> + See also <link linkend="fold-setting-advanced">advanced fold + settings</link>. + </para> + </section> + <section id="Tex_FoldedEnvironments"> + <title>Tex_FoldedEnvironments</title> + <para> + This entry defines which environments will be folded. It is a + comma separated string of words each of which defines a single + environment. The default setting is + <programlisting>verbatim,comment,eq,gather, +align,figure,table,thebibliography, +keywords,abstract,titlepage</programlisting> + The words need not be standard Latex environments. You can + add any word you like. Also, each word will fold up all + environments whose name begins with that word. For example, in + the setting above, the word <literal>"eq"</literal> folds up the + <literal>\begin{equation}</literal>, + <literal>\begin{eqnarray}</literal>, + <literal>\begin{eqnarray*}</literal> environments. To avoid + this, you can replace the word <literal>"eq"</literal> with + <literal>"eq}"</literal>. + </para> + <para> + See also <link linkend="fold-setting-advanced">advanced fold + settings</link>. + </para> + </section> + <section id="Tex_FoldedCommands"> + <title>Tex_FoldedCommands</title> + <para> + This entry defines which commands will be folded. It is a comma + separated string of words each of which defines a single command. + The default setting is empty, i.e no commands are folded. + The words need not be standard Latex commands. You can use whatever + words you like. Each word will fold all commands whose name begins + with that word as in the case of the <link + linkend="Tex_FoldedEnvironments">Tex_FoldedEnvironments</link> + variable. + </para> + <note> + <para> + It is very difficult to fold commands reliably because it is very + difficult to create a regexp which will match a line containing + unmatched parentheses (or curly brackets), but will not match a line + containing matched parentheses. + </para> + <para> + Just to make things safer, only lines which start a command but do + not contain additional curly braces after the command has started are + folded. In other words, if you wanted to fold the the command + <literal>"mycommand"</literal>, then the lines + <programlisting>\mycommand{This is a line +and some more text on the next line +}</programlisting> + will be folded, but the lines + <programlisting>\mycommand{This is a \textbf{line} +and some more text +}</programlisting> + will not be folded. This is a bug which is very difficult to fix. + </para> + </note> + <para> + See also <link linkend="fold-setting-advanced">advanced fold + settings</link>. + </para> + </section> + <section id="Tex_FoldedMisc"> + <title>Tex_FoldedMisc</title> + <para> + This entry defines fold syntax for certain items which do not + naturally fit into the section, environment of command lists. It is a + comma separated list of words. The default value is: + <programlisting>item,preamble,<<<</programlisting> + <note> + <para> + Unlike the other Tex_FoldedXXXX variables, the words in this setting + are limited to take values from the following list: + </para> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Value</entry> + <entry>Meaning</entry> + </row> + </thead> + <tbody> + <row> + <entry>comments</entry> + <entry>Folds up contiguous blocks of comments</entry> + </row> + <row> + <entry>item</entry> + <entry>Folds up the <literal>\item</literal>s within list + environments</entry> + </row> + <row> + <entry>preamble</entry> + <entry>Folds up the preamble of a document. (The part between + the <literal>\documentclass</literal> command and the + <literal>\begin{document}</literal> environment)</entry> + </row> + <row> + <entry><literal><<<</literal></entry> + <entry>Folds defined manually by the user using the + <literal><<<</literal> and + <literal>>>></literal> strings as fold-markers.</entry> + </row> + </tbody> + </tgroup> + </informaltable> + Any other words in the <literal>Tex_FoldedMisc</literal> setting + are silently ignored. + </para> + </note> + </para> + <para> + See also <link linkend="fold-setting-advanced">advanced fold + settings</link>. + </para> + </section> + <section id="fold-setting-advanced"> + <title>Advanced Fold setting details</title> + <para> + The order of the words in the <literal>Tex_FoldedXXXX</literal> + variables is <emphasis>important</emphasis>. The order defines the + order in which the folds are nested. For example, the value + <literal>"subsection,section"</literal> for the + <literal>Tex_FoldedSections</literal> variable will not fold any + subsections at all. This is because the folds are created in the + <emphasis>reverse</emphasis> order in which they occur in the + <literal>Tex_FoldedSections</literal> setting and also, once a fold is + created, the interior of the fold is not examined for creating + additional folds. In the above case, this means that a + <literal>\section</literal> is folded first and then its interior is + not examined further. The correct value should have been + <literal>"section,subsection"</literal> + </para> + <anchor id="fold-setting-adding" /> + <para> + Each of the fold setting variables + <literal>Tex_FoldedSections</literal>, + <literal>Tex_FoldedEnvironments</literal> etc., as explained previously + is a comma separated string of variables. However, to make it easier + to <emphasis>add</emphasis> to the default settings without having to + repeat the whole default setting again, &ls; uses the following logic + in forming the complete setting string from the + <literal>Tex_FoldedXXXX</literal> variables. If the variable starts with + a comma, then <literal>Tex_FoldedXXXX</literal> is added to the end of + the default string rather than replacing it. Similarly, if it ends + with a comma, then it will be prepended to the beginning of the + default setting rather than replacing it. + </para> + <para> + For example, if <literal>Tex_FoldedEnvironments</literal> is set to the + string <literal>"myenv"</literal>, then only an environment of the + form <literal>\begin{myenv}</literal> will be folded. However, if the + <literal>Tex_FoldedEnvironments</literal> setting is + <literal>",myenv"</literal>, then the <literal>\begin{myenv}</literal> + environment will be folded after all other environments in the default + setting have been folded. On the other hand if + <literal>Tex_FoldedEnvironments</literal> is of the form + <literal>"myenv,"</literal>, the <literal>\begin{myenv}</literal> + environment will be folded before the rest of the environments in the + default setting. + </para> + </section> + </section> + <section id="editing-folding"> + <title>Editing the folding.vim file directly</title> + <para> + If you are using version 1.5 of &ls; or older, you will need to + directly edit the + <literal>$VIM/ftplugin/latex-suite/folding.vim</literal> file if you + wish to modify the folding scheme. You will need to modify the + function <literal>MakeTexFolds()</literal> defined in that file to + modify the fold syntax. <literal>MakeTexFolds</literal> makes a number + of calls to <literal>AddSyntaxFoldItem</literal>. Each such call + defines a new "fold item". The order in which these calls are made + defines how the folds are nested. For example, if you desire an + <literal>figure</literal> environment to be nested within a + <literal>section</literal>, then you should define the fold for the + <literal>figure</literal> first. The syntax of + <literal>AddSyntaxFoldItem</literal> is as follows: + <programlisting>AddSyntaxFoldItem(startpat, endpat, startoff, endoff [, startskip, endskip])</programlisting> + If the last two arguments are omitted, then they are assumed to default + to the empty strings <literal>''</literal>. + The explanation for each argument is as follows: + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Argument</entry> + <entry>Explanation</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>startpat</literal></entry> + <entry>a line matching this pattern defines + the beginning of a fold. + </entry> + </row> + <row> + <entry> + <literal>endpat</literal> + </entry> + <entry> + a line matching this pattern defines the end of a fold. + </entry> + </row> + <row> + <entry><literal>startoff</literal></entry> + <entry> + this is the offset from the starting line at which folding will + actually start + </entry> + </row> + <row> + <entry><literal>endoff</literal></entry> + <entry> + like <literal>startoff</literal>, but gives the offset of the + actual fold end from the line satisfying <literal>endpat</literal>. + <literal>startoff</literal> and <literal>endoff</literal> are + necessary when the folding region does not have a specific end + pattern corresponding to a start pattern. for example in &latex;, + <literal>\section{Section Name}</literal> defines the beginning of + a section, but there is no command which specifically ends a + section. Thus a <literal>\section</literal> is assumed to end 1 + line <emphasis>before</emphasis> another section starts. + </entry> + </row> + <row> + <entry> + <literal>startskip</literal> + </entry> + <entry> + A Pattern Which Defines The Beginning Of A "Skipped" Region. + + For example, suppose we define a \itemize fold as follows: + <programlisting><literal>startpat</literal> = '^\s*\\item', +<literal>endpat</literal> = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +<literal>startoff</literal> = 0, +<literal>endoff</literal> = -1</programlisting> + + This defines a fold which starts with a line beginning with an + <literal>\item</literal> and ending one line before a line beginning with an + <literal>\item</literal> or <literal>\end{enumerate}</literal> etc. + + Then, as long as <literal>\item</literal>'s are not nested things are fine. + However, once items begin to nest, the fold started by one + <literal>\item</literal> can end because of an + <literal>\item</literal> in an <literal>\itemize</literal> + environment within this <literal>\item</literal>. i.e, the following can happen: + + <programlisting>\begin{itemize} +\item Some text <------- fold will start here +This item will contain a nested item +\begin{itemize} <----- fold will end here because next line contains \item... +\item Hello +\end{itemize} <----- ... instead of here. +\item Next item of the parent itemize +\end{itemize}</programlisting> + + Therefore, in order to completely define a folding item which + allows nesting, we need to also define a "skip" pattern. + <literal>startskip</literal> and end skip do that. + Leave '' when there is no nesting. + </entry> + </row> + <row> + <entry> + <literal>endskip</literal> + </entry> + <entry> + the pattern which defines the end of the "skip" pattern for + nested folds. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + <note> + <title>Example 1</title> + <para> + A syntax fold region for the latex section is defined with the + following arguments to <literal>AddSyntaxFoldItem</literal>: + <programlisting>startpat = "\\section{" +endpat = "\\section{" +startoff = 0 +endoff = -1 +startskip = '' +endskip = ''</programlisting> + Note that the start and end patterns are thus the same and + <literal>endoff</literal> has a negative value to capture the effect + of a section ending one line before the next starts. + </para> + </note> + <note> + <title>Example 2</title> + <para> + A syntax fold region for the \itemize environment is: + <programlisting>startpat = '^\s*\\item', +endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +startoff = 0, +endoff = -1, +startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', +endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}'</programlisting> + Note the use of <literal>startskip</literal> and + <literal>endskip</literal> to allow nesting. + </para> + </note> + </section> + </section> + <section id="latex-project"> + <title>Multiple file &latex; projects</title> + <anchor id="latex-project-example" /> + <para> + Many &latex; projects contain multiple source files which are + <literal>\include</literal>d from a master file. A typical example of + this situation is a directory layout such as the following + </para> + <para> + <programlisting>thesis/ + main.tex + abstract.tex + intro/ + intro.tex + figures/ + fig1.eps + fig2.eps + chapter1/ + chap1.tex + figures/ + fig1.eps + conclusion/ + conclusion.tex + figures/</programlisting> + </para> + <para> + In the above case, <literal>main.tex</literal> will typically look like + </para> + <para> + <programlisting>% file: main.tex +\documentclass{report} +\begin{document} + +\input{abstract.tex} +\input{intro/intro.tex} +\input{chapter1/chap1.tex} +\input{conclusion/conclusion.tex} + +\end{document}</programlisting> + </para> + <para> + <anchor id="latex-master-file-specification" /> In such situations, you will + need to convey to &ls; that <literal>main.tex</literal> is the main file + which <literal>\input</literal>s the other files. This is done by creating + an empty file called <literal>main.tex.latexmain</literal> in the same + directory in which <literal>main.tex</literal> resides. This file is called + the <emphasis>master file</emphasis> in this manual. See <link + linkend="Tex_MainFileExpression">Tex_MainFileExpression</link> for an + alternative way of specifying the master file. + </para> + <note> + <para> + Here <literal>main.tex.latexmain</literal> is (obviously) a different + file from <literal>main.tex</literal> itself. + <literal>main.tex</literal> need not be renamed. This ofcourse + restricts each directory to have a single master file. + </para> + </note> + <para> + Each time &ls; opens a new &latex; file, it will try to see if it is + part of a multiple file project by searching upwards (to the root of + the file-system) from the current file's directory to see if it finds a + file of the form <literal>*.latexmain</literal>. If such a file is + found, then it is considered that the current file is part of a larger + project. The name of the &latex; master file is inferred directly from + the first part of the <literal>*.latexmain</literal> file as described + in the example above. + </para> + <section id="latex-project-settings"> + <title>&ls; project settings</title> + <para> + If a <link linkend="latex-master-file">master file</link> is found, + then &ls; <literal>:source</literal>s the file. Thus this file needs to + contain valid &vim; commands. This file is typically used to store + project specific settings. + </para> + <para> + Some typical per-project settings which are best put in the master file + are + <simplelist> + <member><link + linkend="Tex_ProjectSourceFiles">Tex_ProjectSourceFiles</link></member> + </simplelist> + </para> + </section> + <section id="latex-master-file"> + <title>Specifying which file to compile</title> + <para> + In the example described <link + linkend="latex-project-example">previously</link>, if you are editing + <literal>intro/intro.tex</literal> and press <literal>\ll</literal>, + then you still want &ls; to compile <literal>main.tex</literal>, + because <literal>intro/intro.tex</literal> is merely a fragment which + is <literal>\input</literal>'ed into <literal>main.tex</literal>. If + the master file is already specified using the + <literal>*.latexmain</literal> convention described <link + linkend="latex-project-example">previously</link>, then &ls; will automatically + compile the master file when you are editing any of its + <literal>\input</literal>'ed fragments. Thus pressing + <literal>\ll</literal> while editing <literal>intro/intro.tex</literal> + will compile <literal>main.tex</literal>. + </para> + <anchor id="Tex_MainFileExpression" /> + <para> + If you wish to use some different logic to specify the main file name, + you can specify a custom expression via the + <literal>Tex_MainFileExpression</literal> variable. This is a string + containing a valid vim expression. In addition, you can use a variable + <literal>modifier</literal> which is in the format used for + <literal>|filename-modifiers|</literal>, for example, + <literal>':p:h'</literal>. You should utilize this variable to modify + the filename of the main file. + <programlisting>let g:Tex_MainFileExpression = 'MainFile(modifier)' +function! MainFile(fmod) + if glob('*.latexmain') != '' + return fnamemodify(glob('*.latexmain'), a:fmod) + else + return '' + endif +endif</programlisting> + </para> + </section> + </section> + <section id="latex-suite-commands-maps"> + <title>&ls; Commands and Maps</title> + <para> + This section describes the maps and commands used in &ls;. It also + describes a way to change the map sequences according to your + preference. + </para> + <section id="latex-suite-maps"> + <title>&ls; Maps</title> + <anchor id="remapping-latex-suite-keys" /> + <para> + Most of the mappings used in &ls; can be mapped to a different key + combination to suit your particular needs. An example best explains the + procedure for doing this. Suppose you want to remap the + <literal><C-j></literal> key which &ls; (actually imaps.vim) uses + to jump to the next placeholder. To do this, you first need to find out + which <literal><Plug></literal> mapping + <literal><C-j></literal> is derived from. You will need to look + at the relevant section of this manual to do this. For example, the + section <link linkend="customize-imap-maps">IMAP mappings</link> has + the information that the <literal><C-j></literal> key is derived + from <literal><Plug>IMAP_JumpForward</literal>. Therefore to + remap the <literal><C-j></literal> key to say + <literal><C-space></literal>, you will need to put a + statement like the following in your <literal>~/.vimrc</literal>. + <programlisting>imap <C-space> <Plug>IMAP_JumpForward</programlisting> + </para> + <note> + <para> + To change the <literal>IMAP</literal> mappings which affect jumping + between placeholders, the <literal>map</literal> statement above has + to be placed in your <literal>~/.vimrc</literal>. For other mappings + you can place the <literal>map</literal> statement in your + <literal>$VIM/ftplugin/tex.vim</literal> file. The reason for this is + that the <literal><C-j></literal> maps are created in + <literal>plugin/imaps.vim</literal>, which is sourced as soon as &vim; + starts before sourcing any ftplugin files. + </para> + </note> + <section id="customize-imap-maps"> + <title>IMAP mappings</title> + <para> + These mappings are utilized for jumping between placeholders as + described <link linkend="place-holders">here</link>. See the <link + linkend="latex-suite-maps">parent section</link> to find out how to + use this information to change the default maps. + </para> + <anchor id="Plug_IMAP_JumpForward" /> + <anchor id="Plug_IMAP_JumpBack" /> + <anchor id="Plug_IMAP_DeleteAndJumpForward" /> + <anchor id="Plug_IMAP_DeleteAndJumBack" /> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Plug map</entry> + <entry>Default Key</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal><Plug>IMAP_JumpForward</literal></entry> + <entry><literal><C-j></literal></entry> + </row> + <row> + <entry><literal><Plug>IMAP_JumpBack</literal></entry> + <entry>(none)</entry> + </row> + <row> + <entry><literal><Plug>IMAP_DeleteAndJumpForward</literal></entry> + <entry>(none)</entry> + </row> + <row> + <entry><literal><Plug>IMAP_DeleteAndJumpBack</literal></entry> + <entry>(none)</entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + <literal><Plug>IMAP_JumpForward</literal> takes you to the + location of the next <link + linkend="place-holders">place-holder</link>. + </para> + <para> + <literal><Plug>IMAP_JumpBack</literal> takes you to the previous + <link linkend="place-holders">place-holder</link>. + </para> + <para> + <literal><Plug>IMAP_DeleteAndJumpForward</literal> deletes the + presently selected place-holder and jumps to the next place-holder + irrespective of whether the present placeholder is empty or not and + ignoring the value of place-holder settings like <link + linkend="Imap_DeleteEmptyPlaceHolders"><literal>g:Imap_DeleteEmptyPlaceHolders</literal></link> + and <link + linkend="Imap_StickyPlaceHolders"><literal>g:Imap_StickyPlaceHolders</literal></link> + </para> + <para> + <literal><Plug>IMAP_DeleteAndJumpBack</literal> deletes the + presently selected place-holder and jumps to the previous place-holder + irrespective of whether the present placeholder is empty or not and + ignoring the value of place-holder settings like <link + linkend="Imap_DeleteEmptyPlaceHolders"><literal>g:Imap_DeleteEmptyPlaceHolders</literal></link> + and <link + linkend="Imap_StickyPlaceHolders"><literal>g:Imap_StickyPlaceHolders</literal></link> + </para> + </section> + <section id="customize-alt-key-maps"> + <title>Alt-Key mappings</title> + <para> + These mappings are are described in the section <link + linkend="altkey-mappings">Alt key macros</link>. See <link + linkend="remapping-latex-suite-keys">the parent section</link> to see + how to use the following information to remap keys. + </para> + <anchor id="Plug_Tex_MathBF" /> + <anchor id="Plug_Tex_MathCal" /> + <anchor id="Plug_Tex_LeftRight" /> + <anchor id="Plug_Tex_InsertItemOnThisLine" /> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Plug Mapping</entry> + <entry>Default Key</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal><Plug>Tex_MathBF</literal></entry> + <entry><literal><Alt-B></literal></entry> + </row> + <row> + <entry><literal><Plug>Tex_MathCal</literal></entry> + <entry><literal><Alt-C></literal></entry> + </row> + <row> + <entry><literal><Plug>Tex_LeftRight</literal></entry> + <entry><literal><Alt-L></literal></entry> + </row> + <row> + <entry><literal><Plug>Tex_InsertItemOnThisLine</literal></entry> + <entry><literal><Alt-I></literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + </section> + <section id="latex-suite-commands"> + <title>Latex Suite Commands</title> + <section id="TMacro"> + <title>:TMacro [{macro}]</title> + <para> + When used without any arguments lists all available macros defined + in runtime ftplugin/latex-suite/macros/ directories and prompts you + to choose one of them. With one argument |:read| this macro under + cursor position. With more than one argument it will not work :) In + Vim >= 6.2 works completion of names of macros (see 'wildmenu', + 'wildmode' for more about command-line completion). + </para> + </section> + <section id="TMacroEdit"> + <title>:TMacroEdit [{macro}]</title> + <para> + Splits window for editing {macro}. When used without any arguments + lists all available macros defined in runtime + ftplugin/latex-suite/macros/ directories and prompt you to choose + one of them. When you try to edit {macro} not from local directory + &ls; will copy it to your local directory with suffix + "-local". If local copy already exists &ls; prompt for + overwriting it. In Vim >= 6.2 works completion of names of macros + (see 'wildmenu', 'wildmode' for more about command-line completion). + </para> + </section> + <section id="TMacroNew"> + <title>:TMacroNew</title> + <para> + Splits window to write new macro. Directory in new buffer is + locally changed to &ls;/macros/. + </para> + </section> + <section id="TMacroDelete"> + <title>:TMacroDelete [{macro}]</title> + <para> + Delets {macro} from your local ftplugin/latex-suite/macros/ + directory. When used without any arguments lists all available + macros defined in &ls;/macros/ directory and prompt you to + choose one of them. When you choose to delete {macro} which is not + in your local directory &ls; will refuse to delete it. In + Vim >= 6.2 works completion of names of macros (see 'wildmenu', + 'wildmode' for more about command-line completion) + </para> + </section> + <section id="TPackage"> + <title>:TPackage [{package, ...}]</title> + <para> + When used without any arguments lists name of the packages for + which support is available. If you are using &vim; GUI and have + <literal>Tex_Menus</literal> set to 1, then it will list all files + found in the <literal>$VIM/ftplugin/latex-suite/packages</literal> + directory. Otherwise, &ls; will list files found in the + <literal>$VIM/ftplugin/latex-suite/dictionaries</literal> directory. + Choosing a file from the list will insert a + <programlisting>\usepackage[&ph;]{<packname>}</programlisting> line into the + buffer at the current cursor location. For &vim; 6.2 and above, you + can use command-line completion to choose a package file. You can also + call <literal>TPackage</literal> with one or more package names + separated with spaces in which case, &ls; will insert + <literal>\usepackage</literal> lines for each of them in turn. + </para> + <para> + After inserting the <literal>\usepackage</literal> line(s), &ls; will + support it (them) in various ways as described in the section <link + linkend="package-actions">Actions taken for supported + packages</link>. + </para> + </section> + <section id="TPackageUpdate"> + <title>:TPackageUpdate</title> + <para> + This command `reads' name of package under cursor and turns on + possible support. + </para> + </section> + <section id="TPackageUpdateAll"> + <title>:TPackageUpdateAll</title> + <para> + After issuing this command latexSuite scans the file in + looking for not declared packages, removing not needed entries + from Packages menu and turning off not necessary packages' + dictionaries. + </para> + </section> + <section id="TTemplate"> + <title>:TTemplate [{template}]</title> + <para> + When used without any arguments lists all available templates + from latex-suite/templates/ directory and prompts to choose + one of them. + With one argument :0|read| {template} file. + With more than one argument it will not work :) + In Vim >= 6.2 works completion of names of macros (see 'wildmenu', + 'wildmode' for more about command-line completion) + </para> + </section> + <section id="TSection"> + <title>:TSection [{argument}]</title> + <para> + Used without any arguments inserts last section type + (|latex-sectioning|). + Accepts arguments: + n> inserts section name in <n> logical level. + Levels are: + <informaltable> + <tgroup cols="2"> + <tbody> + <row><entry>0</entry><entry>part</entry></row> + <row><entry>1</entry><entry>chapter</entry></row> + <row><entry>2</entry><entry>section</entry></row> + <row><entry>3</entry><entry>subsection</entry></row> + <row><entry>4</entry><entry>subsubsection</entry></row> + <row><entry>5</entry><entry>paragraph</entry></row> + <row><entry>6</entry><entry>subparagraph</entry></row> + </tbody> + </tgroup> + </informaltable> + + <informaltable> + <tgroup cols="2"> + <tbody> + <row> + <entry> + +<n> + </entry> + <entry> + inserts section name <n> logical levels above the last + used comand + </entry> + </row><row> + <entry> + -<n> + </entry> + <entry> + inserts section name <n> logical levels below the last + used comand + </entry> + </row><row> + <entry> + + + </entry> + <entry> + inserts section name one logical level below the last + used command (equal to +1). + </entry> + </row><row> + <entry> + ++ + </entry> + <entry> + inserts section name two logical levels below the last + used command (equal to +2). + </entry> + </row><row> + <entry> + - + </entry> + <entry> + inserts section name one logical level over the last + used command (equal to -1). + </entry> + </row><row> + <entry> + -- + </entry> + <entry> + inserts section name two logical levels over the last + used command (equal to -2). + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + + Command accepts also latexSuite mappings (|latex-macros|) + without preceding S and in lowercase: + <programlisting>:TSection pa</programlisting> + will result in <literal>\part{}</literal>. It is possible to use full names of + sections: <literal>:TSection part</literal> + </para> + </section> + <section id="TSectionAdvanced"> + <title>:TSectionAdvanced</title> + <para> + Accepts the same arguments as |TSection| but leads to a couple + of questions (whether you want to include the section in the + table of contents, whether there is a shorter name for the + table of contents) and then creates a more intelligent + template. + </para> + </section> + <section id="TLook"> + <title>:TLook</title> + <para> + Accepts one argument. Will look through .tex files in + directory of edited file for argument. It can be regexp. You + don't have to enclose argument in "". <cr> takes you to + location. Other keys work as described in |latex-viewer|. + Note: TLook uses :grep command and is using 'grepprg'. Its + regular expressions can be different from those of Vim. + </para> + </section> + <section id="TLookBib"> + <title>:TLookBib</title> + <para> + Accepts one argument. Will look through .bib files in + directory of edited file for argument. It can be regexp. You + don't have to enclose argument in "". <cr> takes you to + location. Other keys work as described in |latex-viewer|. + </para> + <note> + <para> + TLookBib uses :grep command and is using 'grepprg'. Its + regular expressions can be different from those of Vim. + </para> + </note> + </section> + <section id="TLookAll"> + <title>:TLookAll</title> + <para> + Accepts one argument. Will look through all files in directory + of edited file for argument. It can be regexp. You don't have + to enclose argument in "". <cr> takes you to location. Other + keys work as described in |latex-viewer|. + Note: TLook uses :grep command and is using 'grepprg'. Its + regular expressions can be different from those of Vim. + </para> + </section> + <section id="TPartComp"> + <title>:TPartComp</title> + <para> + No argument allowed but accepts range in all formats. Define + fragment of interest with :'a,'b, :/a/,/b/, :'<,'> or :20,30. + All other rules of compilation apply. + </para> + </section> + <section id="TPartView"> + <title>:TPartView</title> + <para> + Show last compiled fragment. All rules of viewing apply but + |latex-searching|. + </para> + </section> + <section id="Tshortcuts"> + <title>:Tshortcuts [{arg}]</title> + <para> + Show shortcuts in terminal (not using menu). Without {arg} + you will see simple menu prompting for one of them. Possible + arguments: + <informaltable frame="none"> + <tgroup cols="2"> + <tbody> + <row><entry>g</entry><entry>General shortcuts</entry></row> + <row><entry>e</entry><entry>Environment shortcuts</entry></row> + <row><entry>f</entry><entry>Font shortcuts</entry></row> + <row><entry>s</entry><entry>Section shortcuts</entry></row> + <row><entry>m</entry><entry>Math shortcuts</entry></row> + <row><entry>a</entry><entry>All shortcuts</entry></row> + </tbody> + </tgroup> + </informaltable> + </para> + </section> + </section> + </section> + <section id="customizing-latex-suite"> + <title>Customizing &ls;</title> + <para> + Customizing &ls; is done by defining certain global variables in + <literal>$VIM/ftplugin/tex.vim</literal>, where + <literal>$VIM</literal> corresponds to <literal>~/.vim</literal> for *nix + machines and <literal>~/vimfiles</literal> for windows machines. This file + is not part of the &ls; distribution. You will need to create this file + yourself (or modify it if it exists) if + you need to change any default settings. Since this file is not + included as part of the &ls; distribution, it will not be over-written in + subsequent updates. + </para> + <para> + The default settings in &ls; are defined in + <literal>$VIM/ftplugin/latex-suite/texrc</literal>. Please take a look at + this file if you find this documentation incomplete or confusing. That file + is also well documented. + </para> + <para> + This chapter describes the various settings which effect &ls; and their + default values. The settings are broken up into sections according to the + behavior which they influence. + </para> + <section id="ls-general-purpose-settings"> + <title>General Settings</title> + <section id="Tex_Debug"> + <title>Tex_Debug</title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If set to 1, then &ls; will create certain global debug + statements which can be printed by doing + <programlisting>:call Tex_PrintDebug()</programlisting> + </para> + </para> + </section> + <section id="Tex_UsePython"> + <title>Tex_UsePython</title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If &ls; detects that your vim is python enabled (using + <literal>has('python')</literal>), then it tries to use python in + certain places to speed things up. If this misbehaves, you can set + this to zero, in which case, &ls; will use vimscript to accomplish + the same. + </para> + </para> + </section> + </section> + <section id="customizing-place-holders"> + <title>Place-Holder Customization</title> + <para> + &ls; uses <link linkend="place-holders">place-holders</link> to minimize + using the movement keys while typing. The following settings affect how + place-holders are used. + </para> + <note> + <para> + These setting need to be set in your <literal>~/.vimrc</literal>, not + <literal>$VIM/ftplugin/tex.vim</literal> because these settings affect + the behavior of <literal>imaps.vim</literal>, which is a global plugin, + not a file-type plugin. + </para> + </note> + <section id="Imap_UsePlaceHolders"> + <title>g:Imap_UsePlaceHolders</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Setting this to zero completely disables using place-holders. + </para> + </section> + <section id="Imap_PlaceHolderStart"> + <anchor id="Imap_PlaceHolderEnd"></anchor> + <title>g:Imap_PlaceHolderStart & g:Imap_PlaceHolderEnd</title> + <informaltable frame="all"> + <tgroup cols="3"> + <thead> + <row> + <entry>Setting</entry> + <entry>Type</entry> + <entry>Value</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>Imap_PlaceHolderStart</literal></entry> + <entry>String</entry> + <entry><literal>'<+'</literal></entry> + </row> + <row> + <entry><literal>Imap_PlaceHolderEnd</literal></entry> + <entry>String</entry> + <entry><literal>'+>'</literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + These settings affect the strings displayed at the beginning and end of + the place-holder string. Set these strings to a value different than a + commonly occurring sequence of characters. + </para> + <note> + <title>TIP</title> + <para> + If you use the <literal>latin1</literal> encoding and do not type in + french, then you can set these strings to the <literal>\xab</literal> + and <literal>\xbb</literal> characters (the french quotation marks). + </para> + </note> + </section> + <section id="Imap_DeleteEmptyPlaceHolders"> + <title>g:Imap_DeleteEmptyPlaceHolders</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + When set to one, non-descriptive or empty place-holders are deleted on + pressing <literal><Ctrl-J></literal>. + </para> + </section> + <section id="Imap_StickyPlaceHolders"> + <title>g:Imap_StickyPlaceHolders</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + When set to 1, in visual mode, <literal><Ctrl-J></literal> takes + you to the next placeholder without deleting the current placeholder. + </para> + </section> + </section> + <section id="customizing-macros"> + <title>Macro Customization</title> + <section id="Tex_Env_name"> + <title>Tex_Env_name</title> + <para> + If you wish to wish to expand certain environments differently from + the way &ls; does it, you can define custom expansions using global + variables of the form <literal>Tex_Env_{name}</literal> where + <literal>name</literal> corresponds to the environment. + </para> + <para> + For example, if you press <literal><F5></literal> after typing + <literal>theorem</literal>, &ls; will by default expand it to + <programlisting>\begin{theorem} + \label{&ph;}&ph; +\end{theorem}&ph;</programlisting> + However, if you wish change this to + <programlisting>\begin{theorem} + &ph; +\end{theorem}&ph;</programlisting> + then define the following variable + <programlisting>let g:Tex_Env_theorem = "\\begin{theorem}\<CR>&ph;\<CR>\\end{theorem}"</programlisting> + </para> + <para> + If the expansion uses special keys such as carriage return etc, then + use double-quotes and use the <literal>"\<key>"</literal> + notation for special keys. Backslashes have to be doubled. + </para> + <para> + You could even use strings returned by functions as the expansion by + using the <link + linkend="IMAP_PutTextWithMovement">IMAP_PutTextWithMovement()</link> + function. + </para> + <para> + If the name of the environment contains special characters (for + example, the <literal>eqnarray*</literal> environment), then use the + following form: + <programlisting>let g:Tex_Env_{'eqnarray*'} = + \ "\\begin{eqnarray*}\<CR>&ph; &=& &ph;\<CR>\\end{eqnarray*}&ph;"</programlisting> + This will make pressing <literal><F5></literal> after + <literal>eqnarray*</literal> expand to + <programlisting>\begin{eqnarray*} + &ph; &=& &ph; +\end{eqnarray*}&ph;</programlisting> + </para> + </section> + <section id="Tex_Com_name"> + <title>Tex_Com_name</title> + <para> + If you wish to define new expansions for fast command insertion as + described <link linkend="latex-command-maps">here</link>, or redefine + expansions from the default values in &ls;, you will need to define + variables of the form <literal>g:Tex_Com_{name}</literal> where + <literal>name</literal> is a command name. For example, with the + setting + <programlisting>let g:Tex_Com_frac = "\\frac{&ph;}{&ph;}&ph;"</programlisting> + pressing <literal><F7></literal> after typing + <literal>frac</literal> will change it to <literal>\frac{&ph;}{&ph;}&ph;</literal> + </para> + <para> + See <link linkend="Tex_Env_name">Tex_Env_name</link> for additional + details on how to create this setting in various special + circumstances. + </para> + </section> + <section id="macro-enabling"> + <title>Enabling / disabling macros</title> + <para> + The following variables disable various parts of the macro functionality + of &ls;. See the links to the relevant sections to see what functionality + setting each of the variables to zero will take away. + </para> + <anchor id="Tex_EnvironmentMaps" /> + <anchor id="Tex_EnvironmentMenus" /> + <anchor id="Tex_FontMaps" /> + <anchor id="Tex_FontMenus" /> + <anchor id="Tex_SectionMaps" /> + <anchor id="Tex_SectionMenus" /> + <informaltable frame="all"> + <tgroup cols="3"> + <thead> + <row><entry>Setting</entry><entry>Link to relevant section</entry><entry>Default Value</entry></row> + </thead> + <tbody> + <row><entry><literal>g:Tex_EnvironmentMaps + </literal></entry><entry><link linkend="environment-mappings">Environment Mappings</link></entry><entry>1</entry></row> + <row><entry><literal>g:Tex_EnvironmentMenus</literal></entry><entry></entry><entry>1</entry></row> + <row><entry><literal>g:Tex_FontMaps </literal></entry><entry><link linkend="font-maps">Font Mappings</link></entry><entry>1</entry></row> + <row><entry><literal>g:Tex_FontMenus </literal></entry><entry></entry><entry>1</entry></row> + <row><entry><literal>g:Tex_SectionMaps </literal></entry><entry><link linkend="section-mappings">Section Mappings</link></entry><entry>1</entry></row> + <row><entry><literal>g:Tex_SectionMenus </literal></entry><entry></entry><entry>1</entry></row> + </tbody> + </tgroup> + </informaltable> + </section> + <section id="Tex_UseMenuWizard"> + <title>g:Tex_UseMenuWizard</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If this variable is set to 1, then when an environment is chosen from the + menu then for selected environments, &ls; 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 <link linkend="place-holders">place-holders</link> + marking off the places where fields need to be filled. + </para> + </section> + <section id="Imap_FreezeImap"> + <title>g:Imap_FreezeImap</title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This option when set to 1, temporarily freezes &ls;'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. + </para> + </para> + </section> + <section id="Tex_CatchVisMapErrors"> + <title>g:Tex_CatchVisMapErrors</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + 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 <literal><link + linkend="Tex_Leader">g:Tex_Leader</link></literal> and then type some + illegal keys. It basically maps just the <literal>g:Tex_Leader</literal> + character to a function. + </para> + </section> + <section id="Tex_Diacritics"> + <title>g:Tex_Diacritics</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Whether or not you want to use <link + linkend="diacritic-mappings">diacritics</link>. + </para> + </section> + <section id="Tex_Leader"> + <title>g:Tex_Leader</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>'`'</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + The mappings in &ls; are by default prefixed with the back-tick + character. For example, <literal>`/</literal> inserts + <literal>\frac{&ph;}{&ph;}&ph;</literal> etc. You can change the + prefix with the following setting. + <literal>','</literal>, <literal>'/'</literal>, + <literal>'`'</literal> are preferred values. <literal>''</literal> or + <literal>'\'</literal> will lead to a <emphasis>lot</emphasis> of + trouble. + </para> + <para> + g:Tex_Leader is also used for visual mode mappings for fonts. + </para> + </section> + <section id="Tex_Leader2"> + <title>g:Tex_Leader2</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>','</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + In order to avoid clashes between the large number of visual mode macros + provided, the <link linkend="enclosing-env-threeletter">visual mode + macros for environments</link> and sections start with a character + different from <literal>g:Tex_Leader</literal>. + </para> + </section> + <section id="Tex_PromptedEnvironments"> + <title>g:Tex_PromptedEnvironments</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> <entry><literal>'eqnarray*,eqnarray,equation,equation*,\[,$$,align,align*'</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This string represents a comma separated list of fields corresponding to + environments. Pressing <literal><F5></literal> in insert-mode in + the body of the document asks you to choose from one of these + environments to insert. + </para> + <para> + Leaving this string empty will leave the <literal><F5></literal> + key unmapped + </para> + </section> + <section id="Tex_HotKeyMappings"> + <title>g:Tex_HotKeyMappings</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>'eqnarray*,eqnarray,bmatrix'</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This string represents a comma separated list of environments which are + mapped to <literal><Shift-F-1></literal> through + <literal><Shift-F-4></literal>. For example, pressing + <literal><Shift-F-2></literal> with this setting inserts the + <literal>eqnarray</literal> environment. + </para> + <para> + Leaving this string empty will leave <literal><Shift-F-1></literal> through + <literal><Shift-F-4></literal> unmapped. + </para> + <note> + <para> + Only the first four fields of this list are used. The rest are silently + ignored. + </para> + </note> + </section> + <section id="Tex_PromptedCommands"> + <title>g:Tex_PromptedCommands</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry> + <literal>'footnote,cite,pageref,label'</literal> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + This string represents a comma separated list of &latex; commands + which &ls; uses for the <literal><F7></literal> and + <literal><S-F7></literal> maps as described <link + linkend="latex-command-maps">here</link>. + </para> + <para> + Leaving this string empty will leave the <literal><F7></literal> + key unmapped. + </para> + </section> + <section id="Tex_ItemStyle_environment"> + <title>Tex_ItemStyle_environment</title> + <para> + This setting affects the style which &ls; uses to insert an + <literal>\item</literal> when <literal><Alt-I></literal> is + pressed as described <link linkend="Alt-I">here</link>. By default + &ls; defines styles for the following environments: + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Environment</entry> + <entry>Style</entry> + </row> + </thead> + <tbody> + <row><entry>itemize</entry><entry>\item </entry></row> + <row><entry>enumerate</entry><entry>\item </entry></row> + <row><entry>theindex</entry><entry>\item </entry></row> + <row><entry>thebibliography</entry><entry>\item[<+biblabel+>]{<+bibkey+>} <++></entry></row> + <row><entry>description</entry><entry>\item[<+label+>] <++></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Each style is defined by a variable of the form + <literal>g:Tex_ItemStyle_{envname}</literal> where + <literal>envname</literal> is the name of the environment for which + the style is defined. For example, by default + <programlisting>g:Tex_ItemStyle_description = '\item[<+label+>] <++>'</programlisting> + 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. + </para> + </section> + </section> + <section id="customizing-smart-keys"> + <title>Smart Key Customization</title> + <para> + These settings affect the smart key functionality as described <link + linkend="smart-keys">here</link>. + </para> + <section id="Tex_SmartKeyBS"> + <title>g:Tex_SmartKeyBS</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Whether or not <literal><Backspace></literal> deletes diacritics. + </para> + </section> + <section id="Tex_SmartKeyQuote"> + <title>g:Tex_SmartKeyQuote</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Whether or not the <link linkend="smart-keys">smart quotes</link> + functionality is available. + </para> + <para> + If enabled, the quote characters can be customized by setting the + following variables: + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <thead> + <row> + <entry>Setting</entry> + <entry>Value</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>g:Tex_SmartQuoteOpen</literal></entry> + <entry><literal>"``"</literal></entry> + </row> + <row> + <entry><literal>g:Tex_SmartQuoteClose</literal></entry> + <entry><literal>"''"</literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + Non-English users will want to change these settings to their locale. + These global variables will be ignored if there are buffer-local + variables (with the same name), which may be set in the language specific + package files, such as + <literal>$VIM/ftplugin/latex-suite/packages/german</literal>. + </para> + </section> + </section> + <section id="customizing-latex-completion"> + <title>Latex Completion Customization</title> + <para> + The following settings affect the <link linkend="latex-completion"> + completion</link> functionality in &ls;. + </para> + <section id="completion-window-preferences"> + <title>Window size settings</title> + <para> + These three settings affect the aesthetics of the completion + functionality. + </para> + <anchor id="Tex_ViewerCwindowHeight" /> + <anchor id="Tex_ViewerPreviewHeight" /> + <anchor id="Tex_ExplorerHeight" /> + <anchor id="Tex_ImageDir" /> + <informaltable frame="all"> + <tgroup cols="3"> + <thead> + <row> + <entry>Setting</entry> + <entry>Explanation</entry> + <entry>Default Value</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>g:Tex_ViewerCwindowHeight</literal></entry> + <entry>The height of the <literal>cwindow</literal> which displays the + list of <literal>\label</literal>s etc.</entry> + <entry>5</entry> + </row> + <row> + <entry><literal>g:Tex_ViewerPreviewHeight</literal></entry> + <entry>The height of the preview window which shows the context of a + <literal>\label</literal> etc.</entry> + <entry>10 </entry> + </row> + <row> + <entry><literal>g:Tex_ExplorerHeight</literal></entry> + <entry>The height of the explorer window which lists the files from + which to choose an image file.</entry> + <entry>10</entry> + </row> + <row> + <entry><literal>g:Tex_ImageDir</literal></entry> + <entry>The directory to scan for images</entry> + <entry>''</entry> + </row> + </tbody> + </tgroup> + </informaltable> + </section> + <section id="Tex_BIBINPUTS"> + <title>g:Tex_BIBINPUTS</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>string</entry></row> + <row><entry>Default Value</entry> + <entry><literal>''</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This string describes the directories which are scanned while trying + to search for <literal>.bib</literal> and <literal>.bbl</literal> + files. See the <link linkend="latex-completion-cite">cite completion + section</link> for more details. + </para> + <para> + This string should be set in the syntax accepted by &vim;'s native + <literal>'path'</literal> setting. Do not include the present + directory <literal>'.'</literal>. While searching for + <literal>bibliography</literal> files, the present directory will be + prepended to this variable. + </para> + </section> + <section id="Tex_UseSimpleLabelSearch"> + <title>Tex_UseSimpleLabelSearch</title> + <para> + When set to 1, &ls; searches for <literal>\label</literal>s in all + <literal>.tex</literal> files in the directory containing the file + being edited when <F9> is pressed. See <link + linkend="ls-completion-ref">\ref completion</link> for details. + </para> + </section> + <section id="Tex_ProjectSourceFiles"> + <title>g:Tex_ProjectSourceFiles</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>''</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting is meant to be initialized on a per-project basis using + the <link linkend="latex-master-file">&ls; master file</link> as + described in <link linkend="latex-project">&ls; Project</link> + section. It is a list of source files which are used in the project. + If defined, then instead of using the logic described in + <link + linkend="Tex_UseSimpleLabelSearch">Tex_UseSimpleLabelSearch</link> to + search for files in which to search for <literal>\label</literal>s, we + simply search for <literal>\label</literal>s in this list. This + significantly reduces the time it takes to generate the list of + possible completions for large projects. + </para> + <para> + The list is specified as a whitespace separated list of filenames + relative to the location of the main file. + </para> + </section> + <section id="Tex_RememberCiteSearch"> + <title>g:Tex_RememberCiteSearch</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + When this variable is non-zero, then &ls; will try to remember results + from the <literal>\cite</literal> completion as described in <link + linkend="cite-search-caching">this section</link>. + </para> + </section> + </section> + <section id="customizing-compiling"> + <title>Compiler Customization</title> + <para> + The following settings affect &ls;'s compilation functionality + </para> + <section id="Tex_DefaultTargetFormat"> + <title>g:Tex_DefaultTargetFormat</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>dvi</literal> for windows/*nix and + <literal>pdf</literal> for mac</entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Use this setting to choose the default target format. For example, + setting this to <literal>pdf</literal> makes &ls; compile a pdf file + when you press <literal>\ll</literal> and fire up the + <literal>pdf</literal> viewer on pressing <literal>\lv</literal>. Make + sure that a rules for compiling and viewing have been defined for this + target format as described <link + linkend="Tex_CompileRule_format">here</link> and <link + linkend="Tex_ViewRule_format">here</link>. + </para> + </section> + <section id="Tex_CompileRule_format"> + <title>g:Tex_CompileRule_<format></title> + <para> + Here <literal><format></literal> refers to the target format for + which this rule is defined. &ls; supports compiling into + <literal>dvi</literal>, <literal>ps</literal> and <literal>pdf</literal> + by default. All these rules are strings defined by default as follows: + </para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row> + <entry><literal>g:Tex_CompileRule_dvi</literal></entry> + <entry><literal>'latex -interaction=nonstopmode $*'</literal></entry> + </row> + <row> + <entry><literal>g:Tex_CompileRule_ps</literal></entry> + <entry><literal>'ps2pdf $*'</literal></entry> + </row> + <row> + <entry><literal>g:Tex_CompileRule_pdf</literal></entry> + <entry><literal>'pdflatex -interaction=nonstopmode $*'</literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + If you desire forward and inverse searching via &ls;, you will need to + change <literal>g:Tex_CompileRule_dvi</literal> to include + <literal>-src-specials</literal>. However, this has been known to cause + problems with the output file. Therefore, use this with care. + </para> + </section> + <section fd="Tex_FormatDependency_format"> + <title>g:Tex_FormatDependency_<format></title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>string</entry></row> + <row><entry>Default Value</entry> + <entry><literal>''</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + By default, there are no format dependencies defined. Each definition + is of the form above where <literal><format></literal> is a + string such as <literal>'dvi'</literal> etc. + </para> + <para> + The value of each string is a comma separated string such as 'dvi,ps'. + See the <link linkend="compiler-dependency">Compiler dependency</link> + section to see how to use/specify this setting + </para> + </section> + <section id="Tex_MultipleCompileFormats"> + <title>g:Tex_MultipleCompileFormats</title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>string</entry></row> + <row><entry>Default Value</entry> + <entry><literal>'dvi'</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + </para> + <para> + This is a comma separated string of formats for which the compiler + needs to be called multiple times in order to get cross-references, + citations etc right. See the <link + linkend="compiling-multiple">Compiling multiple times</link> section + for details. + </para> + </section> + <section id="Tex_IgnoredWarnings"> + <title>g:Tex_IgnoredWarnings</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>a new-line separated list of patterns as described + below</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + The default value of this setting is + <programlisting>\"Underfull\n". +\"Overfull\n". +\"specifier changed to\n". +\"You have requested\n". +\"Missing number, treated as zero.\n". +\"There were undefined references\n" +\"Citation %.%# undefined"</programlisting> + This setting defines a set of patterns which will be filtered out when + displaying the output from the latex compiler. This is to aid in + filtering out very common warnings/errors. + </para> + <note> + <para> + Remember to check the value of <link + linkend="Tex_IgnoreLevel"><literal>g:Tex_IgnoreLevel</literal></link> + when you change this setting. For example, if you append a new pattern + which you would like to ignore by default, increase the value of + <literal>g:Tex_IgnoreLevel</literal>. + </para> + </note> + </section> + <section id="Tex_IgnoreLevel"> + <title>g:Tex_IgnoreLevel</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Integer</entry></row> + <row><entry>Default Value</entry> + <entry><literal>7</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting defines a "filter level" or an "ignore level". A value of 7 + for instance means that any warning/error matching with any of the first + 7 fields of <link + linkend="Tex_IgnoredWarnings"><literal>g:Tex_IgnoredWarnings</literal></link> + will be ignored. Setting this value to zero will mean that no + error/warning is ignored. However, even with a value of zero, &ls; will + filter out most of the text which a &latex; compiler typically produces. + Use + <programlisting>TCLevel strict</programlisting> + from within &vim; in order to see all the lines from the compiler's + output. + </para> + </section> + <section id="Tex_UseMakefile"> + <title>g:Tex_UseMakefile</title> + <para> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + When set to 1, then if a <literal>makefile</literal> or + <literal>Makefile</literal> is present in the current directory, then + &ls; sets the <literal>makeprg</literal> option to just + <literal>"make <target>"</literal>, where + <literal><target></literal> is the target format chosen using + the <literal>TCTarget</literal> or <literal>TTarget</literal> + commands. + </para> + <para> + When set to 0, then &ls; will set the <literal>makeprg</literal> + setting to whatever is defined by the <link + linkend="Tex_CompileRule_format">g:Tex_CompileRule_target</link> + setting. + </para> + </para> + </section> + <section id="Tex_GotoError"> + <title>g:Tex_GotoError</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If set to 1, then pressing <literal>\ll</literal> will take you to + the location of the first warning/error, otherwise you will remain in + the original location but the errors/warnings will be listed in the + preview window. + </para> + </section> + </section> + <section id="customizing-viewing"> + <title>Viewer Customization</title> + <para> + The following settings affect how &ls; will display compiled files. + </para> + <section id="Tex_ViewRule_format"> + <title>g:Tex_ViewRule_<format></title> + <para> + Here <literal><format></literal> refers to a format such as + <literal>dvi</literal>, <literal>ps</literal>, etc. This variable defines + the program which will be called to display a file of that format. + </para> + <para> + By default, &ls; defines viewer programs for viewing DVI, PS and PDF + formats as follows: + </para> + <informaltable frame="all"> + <tgroup cols="3"> + <thead> + <row> + <entry></entry> + <entry>Windows</entry> + <entry>Unix</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>g:Tex_ViewRule_dvi</literal></entry> + <entry><literal>'yap -1'</literal></entry> + <entry><literal>'xdvi'</literal></entry> + </row> + <row> + <entry><literal>g:Tex_ViewRule_ps</literal></entry> + <entry><literal>'gsview32'</literal></entry> + <entry><literal>'ghostview'</literal></entry> + </row> + <row> + <entry><literal>g:Tex_ViewRule_pdf</literal></entry> + <entry><literal>'AcroRd32'</literal></entry> + <entry><literal>'xpdf'</literal></entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + For Macintosh systems, these strings are left empty by default. This lets + the system pick the program for each format. If you define these variables + for Mac, the system choice will be over-ridden. + </para> + <para> + &ls; appends <literal>file.format</literal> to the above settings + while calling the external programs. For example, with + <programlisting>let g:Tex_ViewRule_dvi = 'yap -1'</programlisting> + <literal>yap</literal> is called as + <programlisting>!start yap -1 file.dvi</programlisting> from within + &vim;. (The initial <literal>start</literal> is used on + <literal>Windows</literal> platforms is to make <literal>yap</literal> + start as a separate process.) If you find the way &ls; constructs the + command line too restrictive, you can use the <link + linkend="Tex_ViewRuleComplete_format"><literal>Tex_ViewRuleComplete_format</literal></link> + setting for more complete control on how the command line is + constructed while calling the external program for viewing. + </para> + <note> + <para> + For windows, you will need to set the <literal>$PATH</literal> variable + to include the paths to <literal>yap</literal>, + <literal>AcroRd32</literal>, <literal>gsview32</literal> and any other + programs. See your system documentation for how to do this. + </para> + </note> + <note> + <title>Default Viewing Format</title> + <para> + To change the default format for viewing files, set the <link + linkend="Tex_DefaultTargetFormat">g:Tex_DefaultTargetFormat</link> + variable. + </para> + </note> + </section> + <section id="Tex_ViewRuleComplete_format"> + <title>Tex_ViewRuleComplete_<format></title> + <para> + Here <literal><format></literal> refers to the extension of a + output format such as <literal>dvi</literal>, <literal>html</literal> + etc. + </para> + <para> + <literal>Tex_ViewRuleComplete_format</literal> takes precedence over + <literal>Tex_ViewRule_format</literal> if both are specified. By + default, &ls; does not define values for + <literal>Tex_ViewRuleComplete_format</literal> for any + <literal>format</literal>. Unlike in the case of + <literal>Tex_ViewRule_format</literal>, &ls; does not modify + <literal>Tex_ViewRuleComplete_format</literal> at all in constructing + the command line. The only modification is to substitute + <literal>'$*'</literal> everywhere in the string with the name of the + file being viewed (without the extension). + </para> + <note> + <title>IMPORTANT</title> + <para> + Make sure you make the process go into the background otherwise vim + will wait for the viewer to terminate before letting you edit the file + again. + </para> + <para> + To make a process go into the background on a <literal>*nix</literal> + platform, use a trailing <literal>&</literal> in the setting. On + <literal>Windows</literal>, use <literal>start</literal> at the + beginning of the setting. Example: Suppose you have a latex->html + converter which converts a file say foo.tex to a file foo/index.html. + Then you would use: + <programlisting>" On *nix platform +let g:Tex_ViewRuleComplete_html = 'MozillaFirebird $*/index.html &' +" On windows platform +let g:Tex_ViewRuleComplete_html = 'start MozillaFirebird $*/index.html'</programlisting> + </para> + </note> + </section> + </section> + <section id="customizing-menus"> + <title>Menu Customization</title> + <para> + In addition to using the variables defined in this section to affect + the menu-layout permanently (i.e, the layout &ls; will start with), you + can also use the <literal>TeX-Suite > Configure Menu</literal> menu to + dynamically configure the menu layout after &ls; has started. + </para> + <section id="Tex_Menus"> + <title>g:Tex_Menus</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + If set to 0, &ls; will suppress showing all menus. Useful if you mostly + work in terminals. + </para> + </section> + <section id="Tex_MainMenuLocation"> + <title><literal>g:Tex_MainMenuLocation</literal></title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>number</entry></row> + <row><entry>Default Value</entry> + <entry><literal>80</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting decides the location of the first top-level &ls; + menu. You can for example shift all the menus created by &ls; + to the very end by setting this value to a large number like 990. + </para> + </section> + <section id="Tex_MathMenus"> + <title>g:Tex_MathMenus</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + The <literal>Tex-Math</literal> menu consists of hundreds of mathematical + symbols used in &latex;. This menu comprises about 75% of the menus. + </para> + </section> + <section id="Tex_NestElementMenus"> + <title>g:Tex_NestElementMenus</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting controls the "compactness" of the menus. If set to 1, then the + Font, Counter and Dimensioning menus are collected together in a single + menu called <literal>Tex-Elements</literal>, otherwise, they will each get + a separate menu. + </para> + </section> + <section id="Tex_PackagesMenu"> + <title>g:Tex_PackagesMenu</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Setting this to zero will stop &ls; from automatically creating the + <literal>TeX-Suite > Packages > Supported</literal> menu at startup. You + can still create the menu after startup by going to + <literal>TeX-Suite > Configure Menu</literal>. + </para> + </section> + <section id="Tex_NestPackagesMenu"> + <title>g:Tex_NestPackagesMenu</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>String</entry></row> + <row><entry>Default Value</entry> + <entry><literal>'TeX-'</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This string is the prefix added to all the menus created by &ls;. If you + define this variable with a dot (<literal>'.'</literal>) as the last + character, then all the menus created by &ls; will be nested under a + single master menu. For example, set this to + <literal>'&LaTeX-Suite.'</literal> to nest all menus under a menu + called <literal>&LaTeX-Suite</literal>. + </para> + </section> + <section id="Tex_UseUtfMenus"> + <title>g:Tex_UseUtfMenus</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>0</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting controls whether &ls; uses utf-8 symbols to display some of + the mathematical symbols in the <literal>TeX-Math</literal> menu. It is + necessary for your system/GUI to support utf-8. Setting this to 1 has the + side-effect of setting the <literal>'encoding'</literal> option of &vim; + to 'utf-8'. + </para> + </section> + </section> + <section id="customizing-folding"> + <title>Folding Customization</title> + <para> + The following settings control the <link + linkend="latex-folding">folding</link> functionality of &ls;. + </para> + <section id="Tex_Folding"> + <title>g:Tex_Folding</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + Setting this to zero completely disables &ls;'s folding functionality. + However, the <literal>TexFoldTextFunction()</literal> is still available + in case you want to use another folding scheme but still want to continue + using the fold text function. + </para> + </section> + <section id="Tex_AutoFolding"> + <title>g:Tex_AutoFolding</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>Boolean</entry></row> + <row><entry>Default Value</entry> + <entry><literal>1</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting controls whether &ls; automatically creates manual folds for + a file when it is opened. You can still use the <literal>\rf</literal> + mapping to refresh/create folds even when this variable is set to zero. + </para> + </section> + </section> + <section id="customizing-packages"> + <title>Package Handling Customization</title> + <para> + These settings affect the <link linkend="custom-packages">custom + packages</link> functionality in &ls; + </para> + <section id="Tex_TEXINPUTS"> + <title>g:Tex_TEXINPUTS</title> + <informaltable frame="all"> + <tgroup cols="2"> + <tbody> + <row><entry>Type</entry><entry>string</entry></row> + <row><entry>Default Value</entry> + <entry><literal>''</literal></entry></row> + </tbody> + </tgroup> + </informaltable> + <para> + This setting describes the directories scanned by &ls; while searching + for custom user packages as described in the <link + linkend="custom-packages">custom packages</link> section. Do not + include the present directory in this setting. The present directory + is always scanned for custom packages. + </para> + <para> + This string should be set in the syntax accepted by &vim;'s native + <literal>'path'</literal> setting. + </para> + </section> + </section> + </section> + <section id="latex-suite-credits"> + <title>Credits</title> + <para> + And finally, the credits: + </para> + <informaltable frame="none"> + <tgroup cols="2"> + <tbody> + <row> + <entry>Artur R. Czechowski</entry> + <entry>maintains the BSD package of &ls;. Lots of valuable + feedback.</entry> + </row> + <row> + <entry> + Lubomir Host + </entry> + <entry> + provided the diacritics and also helped in development. + + </entry> + </row> + <row> + <entry> + Alexander Wagner + </entry> + <entry> + valuable suggestions during development. + + </entry> + </row> + <row> + <entry> + Luc Hermitte + </entry> + <entry> + his variation of Stephen Riehm's bracketing system is used + in &ls;. + + </entry> + </row> + <row> + <entry> + Gergely Kontra + </entry> + <entry> + the clever little JumpFunc() in imaps.vim is due to him. + The implementation of the templates also borrows from + mu-template.vim by him. + + </entry> + </row> + <row> + <entry> + Dimitri Antoniou + </entry> + <entry> + author of ltags and also provided the nice tip about + forward / reverse search on DVI documents. + + </entry> + </row> + <row> + <entry> + Stephen Riehm + </entry> + <entry> + the extremely helpful bracketing system is from him. + + </entry> + </row> + <row> + <entry> + Alan Schmitt + </entry> + <entry> + provided macros/folding elements. Continued feedback, + bug-reports/fixes. + + </entry> + </row> + <row> + <entry> + Hari Krishna Dara + </entry> + <entry> + for ExecMap(), the clever little function which makes + typing visual mode mappings so much easier and error-free. + + </entry> + </row> + <row> + <entry> + Alan G Isac + </entry> + <entry> + for the comprehensive BibT() function for entering bibtex + entries. + + </entry> + </row> + <row> + <entry> + Gontran Baerts + </entry> + <entry> + for libList.vim + + </entry> + </row> + <row> + <entry> + Peter Heslin + </entry> + <entry> + useful discussion and also a lot of bug fixes. + the %%fakesection in folding.vim. + + </entry> + </row> + <row> + <entry> + Zhang Lin-bo + </entry> + <entry> + lots of very useful additions to folding. The code for customizing + the folding scheme is due to him. + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + <para> + A large number of functions in &ls; come from various other people. + Some of those people might have been missed here. Each function should however + have the author's name/e-mail above it. Thats the more authoritative place to + check out who has done what. + </para> + <anchor id="latex-suite-maintainer"></anchor> + <para> + The current maintainer(s) of &ls; is(are) + </para> + <simplelist> + <member>Srinath Avadhanula <srinath@fastmail.fm></member> + <member>Mikolaj Machowski <mikmach@wp.pl></member> + <member>Benji Fisher <benji@member.AMS.org></member> + </simplelist> + </section> +</article> + +<!-- +vim: et:sw=1:sts=4 +--> diff --git a/vim-latex/doc/latex-suite.xsl b/vim-latex/doc/latex-suite.xsl new file mode 100644 index 0000000..ca6a51a --- /dev/null +++ b/vim-latex/doc/latex-suite.xsl @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0" + xmlns="http://www.w3.org/TR/xhtml1/transitional" + exclude-result-prefixes="#default"> + + <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/> + + <!-- import common customizations --> + <xsl:import href="latex-suite-common.xsl"/> + + <xsl:output method="html" + encoding="ISO-8859-1" + indent="no"/> + + <!-- insert customization here --> + + <xsl:param name="section.autolabel" select="1"/> + <xsl:param name="html.stylesheet" select="'latex-suite.css'"/> + + +</xsl:stylesheet> diff --git a/vim-latex/doc/latexhelp.txt b/vim-latex/doc/latexhelp.txt new file mode 100644 index 0000000..2782424 --- /dev/null +++ b/vim-latex/doc/latexhelp.txt @@ -0,0 +1,2430 @@ +*latexhelp.txt* For Vim version 6.0. Last change: 2001 Dec 20 + + + LATEX HELP 1.6 + translated (with minor changes) for vim + by Mikolaj Machowski + +This file documents LaTeX2e, a document preparation system. LaTeX2e is a +macro package for TeX. + + This is edition 1.6 of the LaTeX2e documentation, and is for the Texinfo +that is distributed as part of Version 19 of GNU Emacs. It uses version +2.134 or later of the texinfo.tex input file. + + This is translated from LATEX.HLP v1.0a in the VMS Help Library. The +pre-translation version was written by George D. Greenwade of Sam Houston +State University. + + The LaTeX 2.09 version was written by Stephen Gilmore <stg@dcs.ed.ac.uk>. + + The LaTeX2e version was adapted from this by Torsten Martinsen +<bullestock@dk-online.dk>. + + Version for vim of this manual was written by Mikolaj Machowski +<mikmach@wp.pl> + + Copyright 1988,1994 Free Software Foundation, Inc. Copyright 1994-1996 +Torsten Martinsen. Copyright for `translation' for vim Mikolaj Machowski 2001. + + Permission is granted to make and distribute verbatim copies of this manual +provided the copyright notice and this permission notice are preserved on +all copies. + + Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + + Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that the sections entitled "Distribution" and "General Public +License" may be included in a translation approved by the author instead of +in the original English. + +============================================================================== +*LaTeX* *latex* + +The LaTeX command typesets a file of text using the TeX program and the LaTeX +Macro package for TeX. To be more specific, it processes an input file +containing the text of a document with interspersed commands that describe how +the text should be formatted. + +1. Commands |latex-commands| +2. Counters |latex-counters| +3. Cross References |latex-references| +4. Definitions |latex-definitions| +5. Document Classes |latex-classes| +6. Layout |latex-layout| +7. Environments |latex-environments| +8. Footnotes |latex-footnotes| +9. Lengths |latex-lengths| +10. Letters |latex-letters| +11. Line & Page Breaking |latex-breaking| +12. Making Paragraphs |latex-paragraphs| +13. Margin Notes |latex-margin-notes| +14. Math Formulae |latex-math| +15. Modes |latex-modes| +16. Page Styles |latex-page-styles| +17. Sectioning |latex-sectioning| +18. Spaces & Boxes |latex-spaces-boxes| +19. Special Characters |latex-special-char| +20. Splitting the Input |latex-inputting| +21. Starting & Ending |latex-start-end| +22. Table of Contents |latex-toc| +23. Terminal Input/Output |latex-terminal| +24. Typefaces |latex-typefaces| +25. Parameters |latex-parameters| + +============================================================================== +1. Commands *latex-commands* + +A LaTeX command begins with the command name, which consists of a \ followed +by either + (a) a string of letters or + (b) a single non-letter. + +Arguments contained in square brackets, [], are optional while arguments +contained in braces, {}, are required. + +NOTE: LaTeX is case sensitive. Enter all commands in lower case unless +explicitly directed to do otherwise. + +============================================================================== +2. Counters *latex-counters* + +|\addtocounter| Add a quantity to a counter +|\alph| Print value of a counter using letters +|\arabic| Print value of a counter using numerals +|\fnsymbol| Print value of a counter using symbols +|\newcounter| Define a new counter +|\refstepcounter| Add to counter, resetting subsidiary counters +|\roman| Print value of a counter using roman numerals +|\setcounter| Set the value of a counter +|\stepcounter| Add to counter, resetting subsidiary counters +|\usecounter| Use a specified counter in a list environment +|\value| Use the value of a counter in an expression + +Everything LaTeX numbers for you has a counter associated with it. The name of +the counter is the same as the name of the environment or command that +produces the number, except with no |\\|. (|lc-enumi| - |lc-enumiv| are used +for the nested |\enumerate| environment.) Below is a list of the counters +used in LaTeX's standard document classes to control numbering. + + |part| |paragraph| |figure| |enumi| |itemi| + |chapter| |subparagraph| |table| |enumii| |itemii| + |section| |page| |footnote| |enumiii| |itemiii| + |subsection| |equation| |mpfootnote| |enumiv| |itemiv| + |subsubsection| + + +\addtocounter{counter}{value} *\addtocounter* + Increments the {counter} by the amount specified by the + {value} argument. The {value} argument can be negative. + +\alph{counter} *\alph* *\Alph* +\Alph{counter} + This command causes the value of the counter to be printed in + alphabetic characters. |\alph| command uses lower case + alphabetic alphabetic characters, i.e., a, b, c... while the + |\Alph| command uses upper case alphabetic characters, i.e., + A, B, C.... + +\arabic{counter} *\arabic* + Causes the value of the {counter} to be printed in Arabic + numbers, i.e., 3. + +\fnsymbol{counter} *\fnsymbol* + Causes the value of the {counter} to be printed in a specific + sequence of nine symbols that can be used for numbering + footnotes. + Note: counter must have a value between 1 and 9 inclusive. + +\newcounter{foo}[counter] *\newcounter* + Defines a new counter named {foo}. The counter is initialized + to zero. The optional argument [counter] causes the counter + {foo} to be reset whenever the counter named in the optional + argument is incremented. + +\refstepcounter{counter} *\refstepcounter* + Command works like |\stepcounter|, except it also defines the + current |\ref| value to be the result of \thecounter. + +\roman{counter} *\roman* *\Roman* +\Roman{counter} + Causes the value of the {counter} to be printed in Roman + numerals. The |\roman| command uses lower case Roman numerals, + i.e., i, ii, iii..., while the |\Roman| command uses upper case + Roman numerals, i.e., I, II, III.... + +\stepcounter{counter} *\stepcounter* + Adds one to the {counter} and resets all subsidiary counters. + +\setcounter{counter}{value} *\setcounter* + Sets the value of the {counter} to that specified by the + {value} argument. + +\usecounter{counter} *\usecounter* + Command is used in the second argument of the |list| + environment to allow the {counter} specified to be used to + number the list items. + +\value{counter} *\value* + Produces the value of the {counter} named in the mandatory + argument. It can be used where LaTeX expects an integer or + number, such as the second argument of a |\setcounter| or + |\addtocounter| command, or in: > + \hspace{\value{foo}\parindent} +< It is useful for doing arithmetic with counters. + +============================================================================== +3. Cross References *latex-references* + +One reason for numbering things like figures and equations is to refer the +reader to them, as in "See Figure 3 for more details." + +|\label| Assign a symbolic name to a piece of text +|\pageref| Refer to a page number +|\ref| Refer to a section, figure or similar + + +\label{key} *\label* + Command appearing in ordinary text assigns to the {key} the + number of the current sectional unit; one appearing inside a + numbered environment assigns that number to the {key}. + + A {key} can consist of any sequence of letters, digits, or + punctuation characters. Upper and lowercase letters are + different. + + To avoid accidentally creating two labels with the same name, + it is common to use labels consisting of a prefix and a suffix + separated by a colon. The prefixes conventionally used are + * 'cha' for chapters + * 'sec' for lower-level sectioning commands + * 'fig' for figures + * 'tab' for tables + * 'eq' for equations + Thus, a label for a figure would look like: > + \label{fig:bandersnatch} + +\pageref{key} *\pageref* + Command produces the page number of the place in the text + where the corresponding |\label| command appears. ie. where + \label{key} appears. + +\ref{key} *\ref* + Command produces the number of the sectional unit, equation + number, ... of the corresponding |\label| command. + +============================================================================== +4. Definitions *latex-definitions* + +|\newcommand| Define a new command +|\newenvironment| Define a new environment +|\newtheorem| Define a new theorem-like environment +|\newfont| Define a new font name + + +\newcommand{cmd}[args]{definition} *\newcommand* *\renewcommand* +\newcommand{cmd}[args][default]{definition} +\renewcommand{cmd}[args]{definition} +\renewcommand{cmd}[args][default]{definition} + +These commands define (or redefine) a command. + +{cmd} A command name beginning with a |\\|. For |\newcommand| it must + not be already defined and must not begin with |\end|; for + |\renewcommand| it must already be defined. + +{args} An integer from 1 to 9 denoting the number of arguments of the + command being defined. The default is for the command to have + no arguments. + +{default} If this optional parameter is present, it means that the + command's first argument is optional. The default value of the + optional argument is default. + +{definition} The text to be substituted for every occurrence of {cmd}; a + parameter of the form #n in {cmd} is replaced by the text of + the nth argument when this substitution takes place. + + *\newenvironment* *\renewenvironment* +\newenvironment{nam}[args]{begdef}{enddef} +\newenvironment{nam}[args][default]{begdef}{enddef} +\renewenvironment{nam}[args]{begdef}{enddef} + +These commands define or redefine an environment. + +{nam} The name of the environment. For |\newenvironment| there must + be no currently defined environment by that name, and the + command \nam must be undefined. For |\renewenvironment| the + environment must already be defined. + +{args} An integer from 1 to 9 denoting the number of arguments of + the newly-defined environment. The default is no arguments. + +{default} If this is specified, the first argument is optional, and + default gives the default value for that argument. + +{begdef} The text substituted for every occurrence of \begin{nam}; a + parameter of the form #n in {cmd} is replaced by the text of + the nth argument when this substitution takes place. + +{enddef} The text substituted for every occurrence of \end{nam}. It + may not contain any argument parameters. + + +\newtheorem{envname}{caption}[within] *\newtheorem* +\newtheorem{envname}[numberedlike]{caption} + +This command defines a theorem-like environment. + +{envname} The name of the environment to be defined. A string of + letters. It must not be the name of an existing environment or + counter. + +{caption} The text printed at the beginning of the environment, right + before the number. This may simply say "Theorem", for example. + +{within} The name of an already defined counter, usually of a sectional + unit. Provides a means of resetting the new theorem counter + within the sectional unit. + +{numberedlike} The name of an already defined theorem-like environment. + +The |\newtheorem| command may have at most one optional argument. + + +\newfont{cmd}{fontname} *\newfont* + Defines the command name {cmd}, which must not be currently + defined, to be a declaration that selects the font named + {fontname} to be the current font. + +============================================================================== +5. Document Classes *latex-classes* + + +\documentclass[options]{class} *\documentclass* + +Valid LaTeX document classes include: + *article *article-class* + *report *report-class* + *letter *letter-class* + *book *book-class* + *slides *slides-class* + +All the standard classes (except slides) accept the following options for +selecting the typeface size (10 pt is default): + +10pt, 11pt, 12pt + +All classes accept these options for selecting the paper size (default is +letter): + +a4paper, a5paper, b5paper, letterpaper, legalpaper, executivepaper + +Miscellaneous options: + +landscape *landscape* + Selects landscape format. Default is portrait. + +titlepage, notitlepage *notitlepage* + Selects if there should be a separate title page. + +leqno *leqno* *rqno* + Equation number on left side of equations. Default is + right side. + +fleqn *fleqn* + Displayed formulas flush left. Default is centred. + +openbib *openbib* + Use "open" bibliography format. + +draft, final *draft* *final* + Mark/do not mark overfull boxes with a rule. Default is + final. + +These options are not available with the slides class: + +oneside, twoside *oneside* *twoside* + Selects one- or twosided layout. Default is oneside, + except for the book class. + +openright, openany *openright* *openany* + Determines if a chapter should start on a right-hand page. + Default is openright for book. + +onecolumn, twocolumn *onecolumn* *twocolumn* + One or two columns. Defaults to one column. + +The slides class offers the option clock for printing the time at the bottom +of each |\note|. + +If you specify more than one option, they must be separated by a comma. + +\usepackage[options]{pkg} *\usepackage* + Additional packages are loaded by this. If you + specify more than one package, they must be separated by a + comma. + +Any options given in the |\documentclass| command that are unknown by the +selected document class are passed on to the packages loaded with |\usepackage|. + +============================================================================== +6. Layout *latex-layout* + +Miscellaneous commands for controlling the general layout of the page. + +|\flushbottom| Make all text pages the same height. +|\onecolumn| Use one-column layout. +|\raggedbottom| Allow text pages of differing height. +|\twocolumn| Use two-column layout. + +\flushbottom *\flushbottom* + Makes all text pages the same height, adding extra vertical + space when necessary to fill out the page. This is the + standard if twocolumn mode is selected. + +\onecolumn *\onecolumn* + Starts a new page and produces single-column output. + +\raggedbottom *\raggedbottom* + Makes all pages the height of the text on that page. No extra + vertical space is added. + +\twocolumn[text] *\twocolumn* + Starts a new page and produces two-column output. If the + optional [text] argument is present, it is typeset in + one-column mode. + +============================================================================== +7. Environments *latex-environments* + + *\begin* *\end* +LaTeX provides a number of different paragraph-making environments. Each +environment begins and ends in the same manner: > + + \begin{environment-name} + . + . + . + \end{environment-name} +< +a. |array| Math arrays +b. |center| Centred lines +c. |description| Labelled lists +d. |enumerate| Numbered lists +e. |eqnarray| Sequences of aligned equations +f. |equation| Displayed equation +g. |figure| Floating figures +h. |flushleft| Flushed left lines +i. |flushright| Flushed right lines +j. |itemize| Bulleted lists +k. |letter| Letters +l. |list| Generic list environment +m. |minipage| Miniature page +n. |picture| Picture with text, arrows, lines and circles +o. |quotation| Indented environment with paragraph indentation +p. |quote-l| Indented environment with no paragraph indentation +q. |tabbing| Align text arbitrarily +r. |table| Floating tables +s. |tabular| Align text in columns +t. |thebibliography| Bibliography or reference list +u. |theorem| Theorems, lemmas, etc +v. |titlepage| For hand crafted title pages +x. |verbatim| Simulating typed input +y. |verse| For poetry and other things + +============================================================================== + a. array *array* +> + \begin{array}{col1col2...coln} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{array} + +Math arrays are produced with the |array| environment. It has a single mandatory +argument describing the number of columns and the alignment within them. Each +column, coln, is specified by a single letter that tells how items in that row +should be formatted. + * c -- for centred + * l -- for flush left + * r -- for flush right +Column entries must be separated by an |&|. Column entries may include other +LaTeX commands. Each row of the array must be terminated with the string |\\|. + +Note that the |array| environment can only be used in |math-mode|, so normally +it is used inside an |equation| environment. + +============================================================================== +b. center *center* +> + \begin{center} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{center} + +The |\center| environment allows you to create a paragraph consisting of lines +that are centred within the left and right margins on the current page. Each +line must be terminated with the string |\\|. + +\centering *\centering* + This declaration corresponds to the |center| environment. This + declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. The text of a |figure| or |table| + can be centred on the page by putting a |\centering| command + at the beginning of the |figure| or |table| environment. + Unlike the |center| environment, the |\centering| command does + not start a new paragraph; it simply changes how LaTeX formats + paragraph units. To affect a paragraph unit's format, the + scope of the declaration must contain the blank line or |\end| + command (of an environment like |quote-l|) that ends the + paragraph unit. + +============================================================================== +c. description *description* +> + \begin{description} + \item [label] First item + \item [label] Second item + . + . + . + \end{description} + +The |description| environment is used to make labelled lists. The label is +bold face and flushed right. + +============================================================================== +d. enumerate *enumerate* +> + \begin{enumerate} + \item First item + \item Second item + . + . + . + \end{enumerate} + +The |enumerate| environment produces a numbered list. Enumerations can be +nested within one another, up to four levels deep. They can also be nested +within other paragraph-making environments. + +\item Each item of an enumerated list begins with an |\item| + command. There must be at least one |\item| command + within the environment. + +The |enumerate| environment uses the |\enumi| through |\enumiv| counters (see +section |latex-counters|). The type of numbering can be changed by redefining +\theenumi etc. + +============================================================================== +e. eqnarray *eqnarray* +> + \begin{eqnarray} + math formula 1 \\ + math formula 2 \\ + . + . + . + \end{eqnarray} + +The |eqnarray| environment is used to display a sequence of equations or +inequalities. It is very much like a three-column |array| environment, with +consecutive rows separated by |\\| and consecutive items within a row separated +by an |&|. + +\nonumber *\nonumber* + An equation number is placed on every line unless that + line has a |\nonumber| command. + +\lefteqn *\lefteqn* + The command |\lefteqn| is used for splitting long + formulas across lines. It typesets its argument in + display style flush left in a box of zero width. + +============================================================================== +f. equation *equation* +> + \begin{equation} + math formula + \end{equation} + +The |equation| environment centres your equation on the page and places the +equation number in the right margin. + +============================================================================== +g. figure *figure* +> + \begin{figure}[placement] + body of the figure + \caption{figure title} + \end{figure} + +Figures are objects that are not part of the normal text, and are usually +"floated" to a convenient place, like the top of a page. Figures will not be +split between two pages. + +The optional argument [placement] determines where LaTeX will try to place +your figure. There are four places where LaTeX can possibly put a float: + +h (Here) at the position in the text where the figure + environment appears. +t (Top) at the top of a text page. +b (Bottom) at the bottom of a text page. +p (Page of floats) on a separate float page, which is a page containing + no text, only floats. + +The standard |report-class| and |article-class| use the default placement +[tbp]. + +The body of the |figure| is made up of whatever text, LaTeX commands, etc. you +wish. + +The \caption command allows you to title your figure. + +============================================================================== +h. flushleft *flushleft* +> + \begin{flushleft} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{flushleft} + +The |flushleft| environment allows you to create a paragraph consisting of +lines that are flushed left, to the left-hand margin. Each line must be +terminated with the string |\\|. + +\raggedright *\raggedright* + This declaration corresponds to the |flushleft| environment. + This declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. Unlike the |flushleft| + environment, the |\raggedright| command does not start a new + paragraph; it simply changes how LaTeX formats paragraph + units. To affect a paragraph unit's format, the scope of the + declaration must contain the blank line or |\end| command (of + an environment like |quote-l|) that ends the paragraph unit. + +============================================================================== +i. flushright *flushright* +> + \begin{flushright} + Text on line 1 \\ + Text on line 2 \\ + . + . + . + \end{flushright} + +The |flushright| environment allows you to create a paragraph consisting of +lines that are flushed right, to the right-hand margin. Each line must be +terminated with the string |\\|. + +\raggedleft *\raggedleft* + This declaration corresponds to the |flushright| environment. + This declaration can be used inside an environment such as + |quote-l| or in a |\parbox|. Unlike the |flushright| + environment, the |\raggedleft| command does not start a new + paragraph; it simply changes how LaTeX formats paragraph + units. To affect a paragraph unit's format, the scope of the + declaration must contain the blank line or |\end| command (of + an environment like |quote-l|) that ends the paragraph unit. + +============================================================================== +j. itemize *itemize* +> + \begin{itemize} + \item First item + \item Second item + . + . + . + \end{itemize} + +The |itemize| environment produces a "bulleted" list. Itemizations can be +nested within one another, up to four levels deep. They can also be nested +within other paragraph-making environments. + +\item *\item* + Each item of an itemized list begins with an |\item| command. + There must be at least one |\item| command within the + environment. + +The itemize environment uses the |\itemi| through |\itemiv| counters (see +section |latex-counters|). The type of numbering can be changed by redefining +\theitemi etc. + +============================================================================== +k. letter *\letter* + +This environment is used for creating letters. See section |latex-letters|. + +============================================================================== +l. list *list* + +The |list| environment is a generic environment which is used for defining many +of the more specific environments. It is seldom used in documents, but often +in macros. +> + \begin{list}{label}{spacing} + \item First item + \item Second item + . + . + . + \end{list} + +'label' The {label} argument specifies how items should be labelled. + This argument is a piece of text that is inserted in a box to + form the {label}. This argument can and usually does contain + other LaTeX commands. + +'spacing' The {spacing} argument contains commands to change the spacing + parameters for the |list|. This argument will most often be + null, i.e., {}. This will select all default spacing which + should suffice for most cases. + +============================================================================== +m. minipage *minipage* +> + \begin{minipage}[position]{width} + text + \end{minipage} + +The |minipage| environment is similar to a |\parbox| command. It takes the +same optional [position] argument and mandatory {width} argument. You may use +other paragraph-making environments inside a |minipage|. Footnotes in a +minipage environment are handled in a way that is particularly useful for +putting footnotes in figures or tables. A |\footnote| or |\footnotetext| +command puts the footnote at the bottom of the minipage instead of at the +bottom of the page, and it uses the |\mpfootnote| counter instead of the +ordinary footnote counter. See sections |latex-counters| and +|latex-footnotes|. + +NOTE: Don't put one |minipage| inside another if you are using footnotes; they +may wind up at the bottom of the wrong minipage. + +============================================================================== +n. picture *picture* +> + size position + \begin{picture}(width,height)(x offset,y offset) + . + . + picture commands + . + . + \end{picture} + +The |picture| environment allows you to create just about any kind of picture +you want containing text, lines, arrows and circles. You tell LaTeX where to +put things in the picture by specifying their coordinates. A coordinate is a +number that may have a decimal point and a minus sign -- a number like 5, 2.3 +or -3.1416. A coordinate specifies a length in multiples of the unit length +|\unitlength|, so if |\unitlength| has been set to 1cm, then the coordinate +2.54 specifies a length of 2.54 centimetres. You can change the value of +|\unitlength| anywhere you want, using the |\setlength| command, but strange +things will happen if you try changing it inside the |picture| environment. + +A position is a pair of coordinates, such as (2.4,-5), specifying the point +with x-coordinate 2.4 and y-coordinate -5. Coordinates are specified in the +usual way with respect to an origin, which is normally at the lower-left +corner of the |picture|. +Note that when a position appears as an argument, it is not enclosed in +braces; the parentheses serve to delimit the argument. + +The |picture| environment has one mandatory argument, which is a position. It +specifies the size of the picture. The environment produces a rectangular box +with width and height determined by this argument's x- and y-coordinates. + +The |picture| environment also has an optional position argument, following +the size argument, that can change the origin. (Unlike ordinary optional +arguments, this argument is not contained in square brackets.) The optional +argument gives the coordinates of the point at the lower-left corner of the +picture (thereby determining the origin). For example, if |\unitlength| has +been set to 1mm, the command: > + \begin{picture}(100,200)(10,20) +> +produces a picture of width 100 millimetres and height 200 millimetres, whose +lower-left corner is the point (10,20) and whose upper-right corner is +therefore the point (110,220). When you first draw a picture, you will omit +the optional argument, leaving the origin at the lower-left corner. If you +then want to modify your picture by shifting everything, you just add the +appropriate optional argument. + +The environment's mandatory argument determines the nominal size of the +picture. This need bear no relation to how large the picture really is; LaTeX +will happily allow you to put things outside the picture, or even off the +page. The picture's nominal size is used by LaTeX in determining how much room +to leave for it. + +Everything that appears in a picture is drawn by the |\put| command. The +command: > + \put (11.3,-.3){...} + +puts the object specified by ... in the picture, with its +reference point at coordinates (11.3,-.3). The reference points for various +objects will be described below. + +The |\put| creates an LR box (|lrbox|). You can put anything in the text +argument of the |\put| that you'd put into the argument of an |\mbox| and +related commands. When you do this, the reference point will be the lower left +corner of the box. + +Picture commands: +|\circle| Draw a circle +|\dashbox| Draw a dashed box +|\frame| Draw a frame around an object +|\framebox(picture)| Draw a box with a frame around it +|\line| Draw a straight line +|\linethickness| Set the line thickness +|\makebox(picture)| Draw a box of the specified size +|\multiput| Draw multiple instances of an object +|\oval| Draw an ellipse +|\put| Place an object at a specified place +|\shortstack| Make a pile of objects +|\vector| Draw a line with an arrow + +\circle[*]{diameter} *\circle* + Command produces a circle with a {diameter} as close to the + specified one as possible. If the *-form of the command is + used, LaTeX draws a solid circle. + Note: only circles up to 40 pt can be drawn. + + +\dashbox{dashlength}(width,height){...} *\dashbox* + Draws a box with a dashed line. The |\dashbox| has an extra + argument which specifies the width of each dash. A dashed box + looks best when the width and height are multiples of the + {dashlength}. + +\frame{...} *\frame* + Puts a rectangular frame around the object specified in the + argument. The reference point is the bottom left corner of the + frame. No extra space is put between the frame and the object. + +\framebox(width,height)[position]{...} *\picture-framebox* + The |\framebox| command is exactly the same as the + |picture-makebox| command, except that it puts a frame around + the outside of the box that it creates. The |\framebox| + command produces a rule of thickness |\fboxrule|, and leaves a + space |\fboxsep| between the rule and the contents of the box. + +\line(x slope,y slope){length} *\line* + Draws a line of the specified length and slope. + Note: LaTeX can only draw lines with slope = x/y, where x and + y have integer values from -6 through 6. + +\linethickness{dimension} *\linethickness* + Declares the thickness of horizontal and vertical lines in a + |picture| environment to be dimension, which must be a + positive length. It does not affect the thickness of slanted + lines (|\line|) and circles (|circle|), or the quarter circles + drawn by |\oval| to form the corners of an oval. + +\makebox(width,height)[position]{...} *picture-makebox* + The makebox command for the |picture| environment is similar + to the normal |\makebox| command except that you must specify + a width and height in multiples of |\unitlength|. + The optional argument, [position], specifies the quadrant that + your text appears in. You may select up to two of the + following: + t - Moves the item to the top of the rectangle + b - Moves the item to the bottom + l - Moves the item to the left + r - Moves the item to the right + + *\multiput* +\multiput(x coord,y coord)(delta x,delta y){no of copies}{object} + This command can be used when you are putting the same + object in a regular pattern across a picture. + +\oval(width,height)[portion] *\oval* + Produces a rectangle with rounded corners. The optional + argument, [portion], allows you to select part of the oval. + t - top portion + b - bottom portion + r - right portion + l - left portion + Note: the "corners" of the oval are made with quarter circles + with a maximum radius of 20 pt, so large "ovals" will look + more like boxes with rounded corners. + +\put(x coord,y coord){ ... } *\put* + Places the item specified by the mandatory argument at the + given coordinates. + +\shortstack[position]{... \\ ... \\ ...} *\shortstack* + The |\shortstack| command produces a stack of objects. + The valid positions are: + r - right of the stack + l - left of the stack + c - centre of the stack (default) + +\vector(x slope,y slope){length} *\vector* + Draws a line with an arrow of the specified length and slope. + The x and y values must lie between -4 and +4, inclusive. + +============================================================================== +o. quotation *quotation* + > + \begin{quotation} + text + \end{quotation} + +The margins of the |quotation| environment are indented on the left and the +right. The text is justified at both margins and there is paragraph +indentation. Leaving a blank line between text produces a new paragraph. + +============================================================================== +p. quote *quote-l* +> + \begin{quote} + text + \end{quote} + +The margins of the |quote-l| environment are indented on the left and the right. +The text is justified at both margins. Leaving a blank line between text +produces a new paragraph. + +============================================================================== +q. tabbing *tabbing* +> + \begin{tabbing} + text \= more text \= still more text \= last text \\ + second row \> \> more \\ + . + . + . + \end{tabbing} + +The |tabbing| environment provides a way to align text in columns. It works by +setting tab stops and tabbing to them much the way you do with an ordinary +typewriter. + +It is best suited for cases where the width of each column is constant and +known in advance. + +This environment can be broken across pages, unlike the |tabular| environment. +The following commands can be used inside a tabbing environment: + + *tab=* +\= Sets a tab stop at the current position. + + *tab>* +\> Advances to the next tab stop. + + *tab<* +\< This command allows you to put something to the left of the + local margin without changing the margin. Can only be used at + the start of the line. + + *tab+* +\+ Moves the left margin of the next and all the following + commands one tab stop to the right. + + *tab-* +\- Moves the left margin of the next and all the following + commands one tab stop to the left. + + *tab'* +\' Moves everything that you have typed so far in the current + column, i.e. everything from the most recent \> (|tab>|), \< + (|tab<|), \' (|tab'|), |\\|, or |\kill| command, to the right + of the previous column, flush against the current column's tab + stop. + + *tab`* +\` Allows you to put text flush right against any tab stop, + including tab stop 0. However, it can't move text to the right + of the last column because there's no tab stop there. The \` + (|tab`|) command moves all the text that follows it, up to the + |\\| or \end{tabbing} command that ends the line, to the right + margin of the tabbing environment. There must be no \> + (|tab>|) or \' (|tab'|) command between the \` (|tab`|) and + the command that ends the line. + + *\kill* +\kill Sets tab stops without producing text. Works just like |\\| + except that it throws away the current line instead of + producing output for it. The effect of any \= (|tab=|), \+ + (|tab+|) or \- (|tab-|) commands in that line remain in + effect. + + *\pushtabs* +\pushtabs Saves all current tab stop positions. Useful for temporarily + changing tab stop positions in the middle of a tabbing + environment. Also restores the tab stop positions saved by the + last |\pushtabs|. + + *taba* +\a In a tabbing environment, the commands \= (|tab=|), \' + (|tab'|) and \` (|tab`|) do not produce accents as normal. + Instead, the commands \a=, \a' and \a` are used. + +This example typesets a Pascal function in a traditional format: +> + \begin{tabbing} + function \= fact(n : integer) : integer;\\ + \> begin \= \+ \\ + \> if \= n $>$ 1 then \+ \\ + fact := n * fact(n-1) \- \\ + else \+ \\ + fact := 1; \-\- \\ + end;\\ + \end{tabbing} + +============================================================================== +r. table *\table* +> + \begin{table}[placement] + body of the table + \caption{table title} + \end{table} + +Tables are objects that are not part of the normal text, and are usually +"floated" to a convenient place, like the top of a page. Tables will not be +split between two pages. + +The optional argument [placement] determines where LaTeX will try to place +your table. There are four places where LaTeX can possibly put a float: + + h (Here) at the position in the text where the table + environment appears. + t (Top) at the top of a text page. + b (Bottom) at the bottom of a text page. + p (Page of floats) on a separate float page, which is a page + containing no text, only floats. + +The standard |report-class| and |article-class| use the default placement [tbp]. + +The body of the table is made up of whatever text, LaTeX commands, etc., you +wish. + +The \caption command allows you to title your table. + +============================================================================== +s. tabular *tabular* +> + \begin{tabular}[pos]{cols} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{tabular} + +or +> + \begin{tabular*}{width}[pos]{cols} + column 1 entry & column 2 entry ... & column n entry \\ + . + . + . + \end{tabular*} + +These environments produce a box consisting of a sequence of rows of items, +aligned vertically in columns. The mandatory and optional arguments consist +of: + +{width} Specifies the width of the tabular* environment. There must be + rubber space between columns that can stretch to fill out the + specified width. + +[pos] Specifies the vertical position; default is alignment on the + centre of the environment. + t - align on top row + b - align on bottom row + +{cols} Specifies the column formatting. It consists of a sequence of + the following specifiers, corresponding to the sequence of + columns and intercolumn material. + l - A column of left-aligned items. + + r - A column of right-aligned items. + + c - A column of centred items. + + | - A vertical line the full height and depth of the + environment. + + @{text} - This inserts text in every row. An @-expression + suppresses the intercolumn space normally inserted + between columns; any desired space between the + inserted text and the adjacent items must be included + in text. An \extracolsep{wd} command in an + @-expression causes an extra space of width {wd} to + appear to the left of all subsequent columns, until + countermanded by another |\extracolsep| command. Unlike + ordinary intercolumn space, this extra space is not + suppressed by an @-expression. An |\extracolsep| + command can be used only in an @-expression in the + cols argument. + + p{wd} - Produces a column with each item typeset in a |\parbox| + of width {wd}, as if it were the argument of a + \parbox[t]{wd} command. However, a |\\| may not appear + in the item, except in the following situations: + 1. inside an environment like |minipage|, |array|, or + |tabular|. + 2. inside an explicit |\parbox|. + 3. in the scope of a |\centering|, |\raggedright|, or + |\raggedleft| declaration. The latter declarations must + appear inside braces or an environment when used in a + p-column element. + + {num}{cols} - Equivalent to num copies of cols, where num is any positive + integer and cols is any list of column-specifiers, + which may contain another -expression. + +These commands can be used inside a tabular environment: + +|\cline| Draw a horizontal line spanning some columns. +|\hline| Draw a * horizontal line spanning all columns. +|\multicolumn| Make an item spanning * several columns. +|\vline| Draw a vertical line. + + +\cline{i-j} *\cline* + The |\cline| command draws horizontal lines across the columns + specified, beginning in column i and ending in column j, + which are identified in the mandatory argument. + +\hline *\hline* + The |\hline| command will draw a horizontal line the width of + the table. It's most commonly used to draw a line at the top, + bottom, and between the rows of the table. + +\multicolumn{cols}{pos}{text} *\multicolumn* + The |\multicolumn| is used to make an entry that spans several + columns. The first mandatory argument, {cols}, specifies the + number of columns to span. The second mandatory argument, + {pos}, specifies the formatting of the entry: + c - centered + l - flushleft + r - flushright. + The third mandatory argument, {text}, specifies what text is + to make up the entry. + +\vline *\vline* + The |\vline| command will draw a vertical line extending the + full height and depth of its row. An |\hfill| command can be + used to move the line to the edge of the column. It can also + be used in an @-expression. + +============================================================================== +t. thebibliography *\thebibliography* +> + \begin{thebibliography}{widestlabel} + \bibitem[label]{cite_key} + . + . + . + \end{thebibliography} + +The |\thebibliography| environment produces a bibliography or reference list. + +In the |article-class|, this reference list is labelled "References"; in the +|report-class|, it is labelled "Bibliography". + +{widestlabel} Text that, when printed, is approximately as wide as the + widest item label produces by the |\bibitem| commands. + +|\bibitem| Specify a bibliography item. +|\cite| Refer to a bibliography item. +|\nocite| Include an item in the bibliography. +|BibTeX| Automatic generation of bibliographies. + +\bibitem *\bibitem* +\bibitem[label]{citekey} + The |\bibitem| command generates an entry labelled by [label]. + If the [label] argument is missing, a number is generated as + the label, using the |\enumi| counter. The {citekey} is any + sequence of letters, numbers, and punctuation symbols not + containing a comma. This command writes an entry on the `.aux' + file containing {citekey} and the item's label. When this + `.aux' file is read by the \begin{document} command, the + item's label is associated with {citekey}, causing the + reference to {citekey} by a |\cite| command to produce the + associated label. + +\cite *\cite* +\cite[text]{keylist} + The {keylist} argument is a list of citation keys. This + command generates an in-text citation to the references + associated with the keys in {keylist} by entries on the `.aux' + file read by the \begin{document} command. + The optional text argument will appear after the + citation, i.e.: > + \cite[p.2]{knuth} +< might produce `[Knuth, p. 2]'. + +\nocite *\nocite* +\nocite{keylist} + The |\nocite| command produces no text, but writes + {keylist}, which is a list of one or more citation + keys, on the `.aux' file. + +BibTeX *BibTeX* *bibtex* + *\bibliographystyle* +If you use the BibTeX program by Oren Patashnik (highly recommended if you +need a bibliography of more than a couple of titles) to maintain your +bibliography, you don't use the |thebibliography| environment. Instead, you +include the lines: +> + \bibliographystyle{style} + \bibliography{bibfile} + +where {style} refers to a file style.bst, which defines how your citations +will look. The standard styles distributed with BibTeX are: + +{alpha} Sorted alphabetically. Labels are formed from name of author and year + of publication. +{plain} Sorted alphabetically. Labels are numeric. +{unsrt} Like plain, but entries are in order of citation. +{abbrv} Like plain, but more compact labels. + +In addition, numerous other BibTeX style files exist tailored to the demands +of various publications. + + *\bibliography* +The argument to |\bibliography| refers to the file bibfile.bib, which should +contain your database in BibTeX format. Only the entries referred to via +|\cite| and |\nocite| will be listed in the bibliography. + +============================================================================== +u. theorem *theorem* +> + \begin{theorem} + theorem text + \end{theorem} + +The |theorem| environment produces "Theorem x" in boldface followed by your +theorem text. + +============================================================================== +v. titlepage *titlepage* +> + \begin{titlepage} + text + \end{titlepage} + +The |titlepage| environment creates a title page, i.e. a page with no printed +page number or heading. It also causes the following page to be numbered page +one. Formatting the title page is left to you. The |\today| command comes in +handy for title pages. + +Note that you can use the |\maketitle| to produce a standard title page. + +============================================================================== +x. verbatim *verbatim* +> + \begin{verbatim} + text + \end{verbatim} + +The |verbatim| environment is a paragraph-making environment that gets LaTeX +to print exactly what you type in. It turns LaTeX into a typewriter with +carriage returns and blanks having the same effect that they would on a +typewriter. + +\verb *\verb* +\verb char literal_text char +\verb*char literal_text char + Typesets literal_text exactly as typed, including + special characters and spaces, using a typewriter |\tt| + type style. There may be no space between |\verb| or + |\verb|* and char (space is shown here only for + clarity). The *-form differs only in that spaces are + printed as `\verb*| |\'. + +============================================================================== +y. verse *verse* +> + \begin{verse} + text + \end{verse} + +The |verse| environment is designed for poetry, though you may find other uses +for it. + +The margins are indented on the left and the right. Separate the lines of each +stanza with |\\|, and use one or more blank lines to separate the stanzas. + +============================================================================== +8. Footnotes *latex-footnotes* + +Footnotes can be produced in one of two ways. They can be produced with one +command, the |\footnote| command. They can also be produced with two commands, +the |\footnotemark| and the |\footnotetext| commands. See the specific command for +information on why you would use one over the other. + +|\footnote| Insert a footnote +|\footnotemark| Insert footnote mark only +|\footnotetext| Insert footnote text only + +\footnote[number]{text} *\footnote* + Command places the numbered footnote text at the bottom of the + current page. The optional argument, number, is used to change + the default footnote number. This command can only be used in + outer paragraph mode; i.e., you cannot use it in sectioning + commands like |\chapter|, in |\figure|, |\table| or in a + |\tabular| environment. + +\footnotemark *\footnotemark* + Command puts the footnote number in the text. This command can + be used in inner paragraph mode. The text of the footnote is + supplied by the |\footnotetext| command. + This command can be used to produce several consecutive + footnote markers referring to the same footnote by using +> + \footnotemark[\value{footnote}] +< + after the first |\footnote| command. + +\footnotetext[number]{text} *\footnotetext* + Command produces the text to be placed at the bottom of the + page. This command can come anywhere after the |\footnotemark| + command. The |\footnotetext| command must appear in outer + paragraph mode. The optional argument, number, is used to + change the default footnote number. + +============================================================================== +9. Lengths *latex-lengths* + +A length is a measure of distance. Many LaTeX commands take a length as an +argument. + +|\newlength| Define a new length. +|\setlength| Set the value of a length. +|\addtolength| Add a quantity to a length. +|\settodepth| Set a length to the depth of something. +|\settoheight| Set a length to the height of something. +|\settowidth| Set a length to the width of something. +|pre-lengths| Lengths that are, like, predefined. + +\newlength{\gnat} *\newlength* + The |\newlength| command defines the mandatory argument, \gnat, + as a length command with a value of 0in. An error occurs if a + \gnat command already exists. + +\setlength{\gnat}{length} *\setlength* + The |\setlength| command is used to set the value of a \gnat + command. The {length} argument can be expressed in any terms + of length LaTeX understands, i.e., inches (in), millimetres + (mm), points (pt), etc. + +\addtolength{\gnat}{length} *\addtolength* + The |\addtolength| command increments a \gnat by the amount + specified in the {length} argument. It can be a negative + amount. + +\settodepth{\gnat}{text} *\settodepth* + The |\settodepth| command sets the value of a \gnat command + equal to the depth of the {text} argument. + +\settoheight{\gnat}{text} *\settoheight* + The |\settoheight| command sets the value of a \gnat command + equal to the height of the {text} argument. + +\settowidth{\gnat}{text} *\settowidth* + The |\settowidth| command sets the value of a \gnat command + equal to the width of the {text} argument. + +Predefined lengths *pre-lengths* + +\width *\width* +\height *\height* +\depth *\depth* +\totalheight *\totalheight* + These length parameters can be used in the arguments of the + box-making commands See section Spaces & Boxes. They specify + the natural width etc. of the text in the box. + \totalheight equals \height + \depth. + To make a box with the text stretched to double the natural + size, e.g., say: > + \makebox[2\width]{Get a stretcher} + +============================================================================== +10. Letters *latex-letters* + +You can use LaTeX to typeset letters, both personal and business. The letter +document class is designed to make a number of letters at once, although you +can make just one if you so desire. + +Your `.tex' source file has the same minimum commands as the other document +classes, i.e., you must have the following commands as a minimum: > + \documentclass{letter} + \begin{document} + ... + letters + ... + \end{document} + +Each letter is a letter environment, whose argument is the name and address of +the recipient. For example, you might have: > + \begin{letter} + {Mr. Joe Smith\\ + 2345 Princess St. \\ + Edinburgh, EH1 1AA} + ... + \end{letter} + +The letter itself begins with the |\opening| command. The text of the letter +follows. It is typed as ordinary LaTeX input. Commands that make no sense in +a letter, like |\chapter|, do not work. The letter closes with a |\closing| +command. + +After the closing, you can have additional material. The |\cc| command produces +the usual "cc: ...". There's also a similar |\encl| command for a list of +enclosures. With both these commands, use|\\| to separate the items. + +These commands are used with the letter class: +|\address| Your return address. +|\cc| Cc list. closing Saying goodbye. +|\encl| List of enclosed material. +|\location| Your organisation's address. +|\makelabels| Making address labels. +|\name| Your name, for the return address. +|\opening| Saying hello. +|\ps| Adding a postscript. +|\signature| Your signature. +|\startbreaks| Allow page breaks. +|\stopbreaks| Disallow page breaks. +|\telephone| Your phone number. + +\address{Return address} *\address* + The return address, as it should appear on the letter and the + envelope. Separate lines of the address should be separated + by |\\| commands. If you do not make an |\address| declaration, + then the letter will be formatted for copying onto your + organisation's standard letterhead. (See section Overview of + LaTeX and Local Guide, for details on your local + implementation). If you give an |\address| declaration, then + the letter will be formatted as a personal letter. + +\cc{Kate Schechter\\Rob McKenna} *\cc* + Generate a list of other persons the letter was sent to. Each + name is printed on a separate line. + +\closing{text} *\closing* + The letter closes with a |\closing| command, i.e., > + \closing{Best Regards,} \encl{CV\\Certificates} +< Generate a list of enclosed material. + +\location{address} *\location* + This modifies your organisation's standard address. This only + appears if the firstpage pagestyle is selected. + +\makelabels{number} *\makelabels* + If you issue this command in the preamble, LaTeX will create a + sheet of address labels. This sheet will be output before the + letters. + +\name{June Davenport} *\name* + Your name, used for printing on the envelope together with the + return address. + +\opening{text} *\opening* + The letter begins with the |\opening| command. The mandatory + argument, text, is whatever text you wish to start your + letter, i.e., > + \opening{Dear Joe,} + +\ps *\ps* + Use this command before a postscript. + +\signature{Harvey Swick} *\signature* + Your name, as it should appear at the end of the letter + underneath the space for your signature. Items that should go + on separate lines should be separated by |\\| commands. + +\startbreaks *\startbreaks* + Used after a |\stopbreaks| command to allow page breaks again. + +\stopbreaks *\stopbreaks* + Inhibit page breaks until a |\startbreaks| command occurs. + +\telephone{number} *\telephone* + This is your telephone number. This only appears if the + firstpage pagestyle is selected. + +============================================================================== +11. Line & Page Breaking *latex-breaking* + +The first thing LaTeX does when processing ordinary text is to translate your +input file into a string of glyphs and spaces. To produce a printed document, +this string must be broken into lines, and these lines must be broken into +pages. In some environments, you do the line breaking yourself with the |\\| +command, but LaTeX usually does it for you. + +|\\| Start a new line +|hyph-| Insert explicit hyphenation +|\cleardoublepage| Start a new right-hand page +|\clearpage| Start a new page +|\enlargethispage| Enlarge the current page a bit +|\fussy| Be fussy about line breaking +|\hyphenation| Tell LaTeX how to hyphenate a word +|\linebreak| Break the line +|\newline| Break the line prematurely +|\newpage| Start a new page +|\nolinebreak| Don't break the current line +|\nopagebreak| Don't make a page break here +|\pagebreak| Please make a page break here +|\sloppy| Be sloppy about line breaking + +\\[*][extraspace] *\\* *\\\\* + The |\\| command tells LaTeX to start a new line. It has an + optional argument, [extraspace], that specifies how much extra + vertical space is to be inserted before the next line. This + can be a negative amount. + The \\* command is the same as the ordinary |\\| command + except that it tells LaTeX not to start a new page after the + line. + +\- *hyph-* + The \- command tells LaTeX that it may hyphenate the word at + that point. LaTeX is very good at hyphenating, and it will + usually find all correct hyphenation points. The \- command is + used for the exceptional cases. + Note: when you insert \- commands in a word, the word will + only be hyphenated at those points and not at any of the + hyphenation points that LaTeX might otherwise have chosen. + +\cleardoublepage *\cleardoublepage* + The |\cleardoublepage| command ends the current page and causes + all figures and tables that have so far appeared in the input + to be printed. In a two-sided printing style (|twoside|), it + also makes the next page a right-hand (odd-numbered) page, + producing a blank page if necessary. + +\clearpage *\clearpage* + The |\clearpage| command ends the current page and causes all + figures and tables that have so far appeared in the input to + be printed. + +\enlargethispage{size} *\enlargethispage* +\enlargethispage*{size} + Enlarge the textheight for the current page by the + specified amount; e.g.: > + + \enlargethispage{\baselineskip} +< + will allow one additional line. The starred form + tries to squeeze the material together on the page as + much as possible. This is normally used together with + an explicit |\pagebreak|. + +\fussy *\fussy* + This declaration (which is the default) makes TeX more fussy + about line breaking. This can avoids too much space between + words, but may produce overfull boxes. This command cancels + the effect of a previous |\sloppy| command. + +\hyphenation{words} *\hyphenation* + The |\hyphenation| command declares allowed hyphenation points, + where words is a list of words, separated by spaces, in which + each hyphenation point is indicated by a - character. + +\linebreak[number] *\linebreak* + The |\linebreak| command tells LaTeX to break the current line + at the point of the command. With the optional argument, + number, you can convert the |\linebreak| command from a demand + to a request. The [number] must be a number from 0 to 4. The + higher the number, the more insistent the request is. The + |\linebreak| command causes LaTeX to stretch the line so it + extends to the right margin. + +\newline *\newline* + The |\newline| command breaks the line right where it is. It + can only be used in paragraph mode. + +\newpage *\newpage* + The |\newpage| command ends the current page. + +\nolinebreak[number] *\nolinebreak* + The |\nolinebreak| command prevents LaTeX from breaking the + current line at the point of the command. With the optional + argument, [number], you can convert the |\nolinebreak| command + from a demand to a request. The [number] must be a number from 0 + to 4. The higher the number, the more insistent the request + is. + +\nopagebreak[number] *\nopagebreak* + The |\nopagebreak| command prevents LaTeX from breaking the + current page at the point of the command. With the optional + argument, [number], you can convert the |\nopagebreak| command + from a demand to a request. The [number] must be a number from + 0 to 4. The higher the number, the more insistent the request + is. + +\pagebreak[number] *\pagebreak* + The |\pagebreak| command tells LaTeX to break the current page + at the point of the command. With the optional argument, + [number], you can convert the |\pagebreak| command from a + demand to a request. The [number] must be a number from 0 to + 4. The higher the number, the more insistent the request is. + +\sloppy *\sloppy* + This declaration makes TeX less fussy about line breaking. + This can prevent overfull boxes, but may leave too much space + between words. + Lasts until a |\fussy| command is issued. + +============================================================================== +12. Making Paragraphs *latex-paragraphs* + +A paragraph is ended by one or more completely blank lines -- lines not +containing even a |\%|. A blank line should not appear where a new paragraph +cannot be started, such as in math mode or in the argument of a sectioning +command. + +|\indent| Indent this paragraph. +|\noindent| Do not indent this paragraph. +|\par| Another way of writing a blank line. + +\indent *\indent* + This produces a horizontal space whose width equals the width + of the paragraph indentation. It is used to add paragraph + indentation where it would otherwise be suppressed. + +\noindent *\noindent* + When used at the beginning of the paragraph, it suppresses the + paragraph indentation. It has no effect when used in the + middle of a paragraph. + +\par *\par* + Equivalent to a blank line; often used to make command or + environment definitions easier to read. + +============================================================================== +13. Margin Notes *latex-margin-notes* + +\marginpar[left]{right} *\marginpar* + This command creates a note in the margin. The first line will + be at the same height as the line in the text where the + |\marginpar| occurs. + + When you only specify the mandatory argument {right}, the text + will be placed: + * in the right margin for one-sided layout + * in the outside margin for two-sided layout (|twoside|) + * in the nearest margin for two-column layout (|twocolumn|) + +\reversemarginpar *\reversemarginpar* + By issuing the command |\reversemarginpar|, you can force the + marginal notes to go into the opposite (inside) margin. + +When you specify both arguments, left is used for the left margin, and right +is used for the right margin. + +The first word will normally not be hyphenated; you can enable hyphenation by +prefixing the first word with a \hspace{0pt} command (|hspace|). + +============================================================================== +14. Math Formulae *latex-math* + *displaymath* +There are three environments (|latex-environments|) that put LaTeX in math +mode: +|math| For Formulae that appear right in the text. +|displaymath| For Formulae that appear on their own line. +|equation| The same as the displaymath environment except that it adds an + equation number in the right margin. + +The |math| environment can be used in both paragraph and LR mode, but the +|displaymath| and |equation| environments can be used only in paragraph mode. The +|math| and |displaymath| environments are used so often that they have the +following short forms: + \(...\) instead of \begin{math}...\end{math} + \[...\] instead of \begin{displaymath}...\end{displaymath} + +In fact, the math environment is so common that it has an even shorter form: + $ ... $ instead of \(...\) + +|sub-sup| Also known as exponent or index. +|math-symbols| Various mathematical squiggles. +|math-spacing| Thick, medium, thin and negative spaces. +|math-misc| Stuff that doesn't fit anywhere else. + +========== +Subscripts & Superscripts *sub-sup* + *subscripts* *superscripts* + +To get an expression exp to appear as a subscript, you just type _{exp}. To +get exp to appear as a superscript, you type ^{exp}. LaTeX handles +superscripted superscripts and all of that stuff in the natural way. It even +does the right thing when something has both a subscript and a superscript. + +========== +Math Symbols *math-symbols* + +LaTeX provides almost any mathematical symbol you're likely to need. The +commands for generating them can be used only in math mode. For example, if +you include > + $\pi$ +in your source, you will get the symbol in your output. + +========== +Spacing in Math Mode *math-spacing* + +In a math environment, LaTeX ignores the spaces you type and puts in the +spacing that it thinks is best. LaTeX formats mathematics the way it's done in +mathematics texts. If you want different spacing, LaTeX provides the following +four commands for use in math mode: + \; - a thick space *math;* + \: - a medium space *math:* + \, - a thin space *math,* + \! - a negative thin space *matn!* + +========== +Math Miscellany *math-misc* + +\cdots *\cdots* + Produces a horizontal ellipsis where the dots are raised to + the centre of the line. +\ddots *\ddots* + Produces a diagonal ellipsis. +\frac{num}{den} *\frac* + Produces the fraction num divided by den. +\ldots *\ldots* + Produces an ellipsis. This command works in any mode, not just + math mode. +\overbrace{text} *\overbrace* + Generates a brace over text. +\overline{text} *\overline* + Causes the argument text to be overlined. +\sqrt[root]{arg} *\sqrt* + Produces the square root of its argument. The optional + argument, [root], determines what root to produce, i.e., the + cube root of x+y would be typed as: > + $\sqrt[3]{x+y}$. +\underbrace{text} *\underbrace* + Generates text with a brace underneath. +\underline{text} *\underline* + Causes the argument text to be underlined. This command can + also be used in paragraph and LR mode. +\vdots *\vdots* + Produces a vertical ellipsis. + +============================================================================== +15. Modes *latex-modes* + +When LaTeX is processing your input text, it is always in one of three modes: + Paragraph mode *paragraph-mode* + Math mode *math-mode* + Left-to-right mode, called LR mode for short. *lr-mode* + +LaTeX changes mode only when it goes up or down a staircase to a different +level, though not all level changes produce mode changes. Mode changes occur +only when entering or leaving an environment, or when LaTeX is processing the +argument of certain text-producing commands. + +|paragraph-mode| is the most common; it's the one LaTeX is in when processing +ordinary text. In that mode, LaTeX breaks your text into lines and breaks the +lines into pages. LaTeX is in |math-mode| when it's generating a mathematical +formula. In |lr-mode|, as in |paragraph-mode|, LaTeX considers the output that +it produces to be a string of words with spaces between them. However, unlike +|paragraph-mode|, LaTeX keeps going from left to right; it never starts a new +line in |lr-mode|. Even if you put a hundred words into an |\mbox|, LaTeX would +keep typesetting them from left to right inside a single box, and then +complain because the resulting box was too wide to fit on the line. + +LaTeX is in |lr-mode| when it starts making a box with an |\mbox| command. You +can get it to enter a different mode inside the box - for example, you can +make it enter |math-mode| to put a formula in the box. There are also several +text-producing commands and environments for making a box that put LaTeX in +|paragraph-mode|. The box make by one of these commands or environments will be +called a |\parbox|. When LaTeX is in |paragraph-mode| while making a box, it is +said to be in "inner paragraph mode". Its normal |paragraph-mode|, which it +starts out in, is called "outer paragraph mode". + +============================================================================== +16. Page Styles *latex-page-styles* + +The |\documentclass| command determines the size and position of the page's head +and foot. The page style determines what goes in them. + +|\maketitle| Generate a title page. +|\pagenumbering| Set the style used for page numbers. +|\pagestyle| Change the headings/footings style. +|\thispagestyle| Change the headings/footings style for this page. + +\maketitle *\maketitle* + The |\maketitle| command generates a title on a separate title + page - except in the |\article| class, where the title normally + goes at the top of the first page. Information used to + produce the title is obtained from the following declarations: + + |\author| Who wrote this stuff? + |\date| The date the document was created. + |\thanks| A special form of footnote. + |\title| How to set the document title. + + \author{names} *\author* *\and* + The |\author| command declares the author(s), where + names is a list of authors separated by \and commands. + Use |\\| to separate lines within a single author's + entry -- for example, to give the author's institution + or address. + + \date{text} *\date* + The |\date| command declares text to be the document's + date. With no |\date| command, the current date is + used. + + \thanks{text} *\thanks* + The |\thanks| command produces a |\footnote| to the + title. + + \title{text} *\title* + The |\title| command declares text to be the title. Use + |\\| to tell LaTeX where to start a new line in a long + title. + +\pagenumbering{numstyle} *\pagenumbering* + Specifies the style of page numbers. Possible values of + 'numstyle' are: + arabic - Arabic numerals *arabic* + roman - Lowercase Roman numerals *roman* + Roman - Uppercase Roman numerals *Roman* + alph - Lowercase letters *alph* + Alph - Uppercase letters *Alph* + +\pagestyle{option} *\pagestyle* + *plain* *empty* *headings* + The |\pagestyle| command changes the style from the current + page on throughout the remainder of your document. + The valid options are: + plain - Just a plain page number. + empty - Produces empty heads and feet no page numbers. + headings - Puts running headings on each page. The document + style specifies what goes in the headings. + myheadings - You specify what is to go in the heading with the + |\markboth| or the |\markright| commands. + + |\markboth| Set left and right headings. + |\markright| Set right heading only. + + \markboth{left head}{right head} *\markboth* + The |\markboth| command is used in conjunction with the + page style myheadings for setting both the left and + the right heading. + Note that a "left-hand heading" is generated by the + last |\markboth| command before the end of the page, + while a "right-hand heading" is generated by the first + |\markboth| or |\markright| that comes on the page if + there is one, otherwise by the last one before the + page. + + + \markright{right head} *\markright* + The |\markright| command is used in conjunction with + the page style |\myheadings| for setting the right + heading, leaving the left heading unchanged. + Note that a "left-hand heading" is generated by the + last |\markboth| command before the end of the page, + while a "right-hand heading" is generated by the first + |\markboth| or |\markright| that comes on the page if + there is one, otherwise by the last one before the + page. + +\thispagestyle{option} *\thispagestyle* + The |\thispagestyle| command works in the same manner as the + |\pagestyle| command except that it changes the style for the + current page only. + +============================================================================== +17. Sectioning *latex-sectioning* + +Sectioning commands provide the means to structure your text into units. +|\part| +|\chapter| (report and book class only) +|\section| +|\subsection| +|\subsubsection| +|\paragraph| +|\subparagraph| + +All sectioning commands take the same general form, i.e., + + *\part* + *\chapter* (report and book class only) + *\section* *\subsection* *\subsubsection* + *\paragraph* *\subparagraph* +\chapter[optional]{title} + In addition to providing the heading in the text, the + mandatory argument of the sectioning command can appear in two + other places: + 1. The table of contents + 2. The running head at the top of the page. You may not want + the same thing to appear in these other two places as + appears in the text heading. To handle this situation, the + sectioning commands have an optional argument that provides + the text for these other two purposes. + +All sectioning commands have *\-forms that print a title, but do not include a +number and do not make an entry in the table of contents. + +\appendix *\appendix* + The |\appendix| command changes the way sectional units are + numbered. The |\appendix| command generates no text and does + not affect the numbering of parts. The normal use of this + command is something like: > + \chapter{The First Chapter} + ... + \appendix \chapter{The First Appendix} + + +============================================================================== +18. Spaces & Boxes *latex-spaces-boxes* + +All the predefined length parameters See section Predefined lengths can be +used in the arguments of the box-making commands. + + Horizontal space: + +|\dotfill| Stretchable horizontal dots. +|\hfill| Stretchable horizontal space. +|\hrulefill| Stretchable horizontal rule. +|\hspace| Fixed horizontal space. + + Vertical space: + +|\addvspace| Fixed vertical space. +|\bigskip| Fixed vertical space. +|\medskip| Fixed vertical space. +|\smallskip| Fixed vertical space. +|\vfill| Stretchable vertical space. +|\vspace| Fixed vertical space. + + Boxes: + +|\fbox| Framebox. +|\framebox| Framebox, adjustable position. +|\lrbox| An environment like |\sbox|. +|\makebox| Box, adjustable position. +|\mbox| Box. +|\newsavebox| Declare a name for saving a box. +|\parbox| Box with text in paragraph mode. +|\raisebox| Raise or lower text. +|\rule| Lines and squares. +|\savebox| Like |\makebox|, but save the text for later use. +|\sbox| Like |\mbox|, but save the text for later use. +|\usebox| Print saved text. + +Horizontal space: *latex-hor-space* + +LaTeX removes horizontal space that comes at the end of a line. If you don't +want LaTeX to remove this space, include the optional * argument. Then the +space is never removed. + +\dotfill *\dotfill* + The |\dotfill| command produces a "rubber length" that produces + dots instead of just spaces. + +\hfill *\hfill* + The |\hfill| fill command produces a "rubber length" which can + stretch or shrink horizontally. It will be filled with spaces. + +\hrulefill *\hrulefill* + The |\hrulefill| fill command produces a "rubber length" which + can stretch or shrink horizontally. It will be filled with a + horizontal rule. + +\hspace[*]{length} *\hspace* + The |\hspace| command adds horizontal space. The length of the + space can be expressed in any terms that LaTeX understands, + i.e., points, inches, etc. You can add negative as well as + positive space with an |\hspace| command. Adding negative space + is like backspacing. + + +Vertical space: *latex-ver-space* + +LaTeX removes vertical space that comes at the end of a page. If you don't +want LaTeX to remove this space, include the optional * argument. Then the +space is never removed. + +\addvspace{length} *\addvspace* + The |\addvspace| command normally adds a vertical space of + height length. However, if vertical space has already been + added to the same point in the output by a previous + |\addvspace| command, then this command will not add more space + than needed to make the natural length of the total vertical + space equal to length. + +\bigskip *\bigskip* + The |\bigskip| command is equivalent to \vspace{bigskipamount} + where bigskipamount is determined by the document class. + +\medskip *\medskip* + The |\medskip| command is equivalent to \vspace{medskipamount} + where medskipamount is determined by the document class. + +\smallskip *\smallskip* + The |\smallskip| command is equivalent to + \vspace{smallskipamount} where smallskipamount is determined + by the document class. + +\vfill *\vfill* + The |\vfill| fill command produces a rubber length which can + stretch or shrink vertically. + +\vspace[*]{length} *\vspace* + The |\vspace| command adds vertical space. The length of the + space can be expressed in any terms that LaTeX understands, + i.e., points, inches, etc. You can add negative as well as + positive space with an |\vspace| command. + + +Boxes: *latex-boxes* + +\fbox{text} *\fbox* + The |\fbox| command is exactly the same as the |\mbox| command, + except that it puts a frame around the outside of the box that + it creates. + +\framebox[width][position]{text} *\framebox* + The |\framebox| command is exactly the same as the |\makebox| + command, except that it puts a frame around the outside of the + box that it creates. + The |\framebox| command produces a rule of thickness + |\fboxrule|, and leaves a space |\fboxsep| between the rule and + the contents of the box. + +lrbox *\lrbox* +\begin{lrbox}{cmd} text \end{lrbox} + This is the environment form of |\sbox|. + The text inside the environment is saved in the box cmd, which + must have been declared with |\newsavebox|. + +\makebox[width][position]{text} *\makebox* + The |\makebox| command creates a box just wide enough to + contain the text specified. The width of the box is specified + by the optional [width] argument. The position of the text + within the box is determined by the optional [position] + argument. + c -- centred (default) + l -- flushleft + r -- flushright + s -- stretch from left to right margin. The text must + contain stretchable space for this to work. + See section |\picture-makebox|. + +\mbox{text} *\mbox* + The |\mbox| command creates a box just wide enough to hold the + text created by its argument. + Use this command to prevent text from being split across + lines. + +\newsavebox{cmd} *\newsavebox* + Declares {cmd}, which must be a command name that is not + already defined, to be a bin for saving boxes. + + +\parbox[position][height][innerpos]{width}{text} *\parbox* + A parbox is a box whose contents are created in + |\paragraph-mode|. The |\parbox| has two + + Mandatory arguments: +'width' specifies the width of the parbox +'text' the text that goes inside the parbox. + + Optional arguments: +'position' LaTeX will position a parbox so its centre lines up with the + centre of the text line. The optional position argument allows + you to line up either the top or bottom line in the parbox + (default is top). + +'height' If the height argument is not given, the box will have the + natural height of the text. + +'innerpos' The inner-pos argument controls the placement of the text + inside the box. If it is not specified, position is used. + t -- text is placed at the top of the box + c -- text is centred in the box + b -- text is placed at the bottom of the box + s -- stretch vertically. The text must contain + vertically stretchable space for this to work. + + A |\parbox| command is used for a parbox containing a small + piece of text, with nothing fancy inside. In particular, you + shouldn't use any of the paragraph-making environments inside + a |\parbox| argument. For larger pieces of text, including ones + containing a paragraph-making environment, you should use a + |\minipage| environment. + +\raisebox{distance}[extendabove][extendbelow]{text} *\raisebox* + The |\raisebox| command is used to raise or lower text. The + first mandatory argument specifies how high the text is to be + raised (or lowered if it is a negative amount). The text + itself is processed in LR mode. + Sometimes it's useful to make LaTeX think something has a + different size than it really does - or a different size than + LaTeX would normally think it has. The |\raisebox| command + lets you tell LaTeX how tall it is. + The first optional argument, extend-above, makes LaTeX think + that the text extends above the line by the amount specified. + The second optional argument, extend-below, makes LaTeX think + that the text extends below the line by the amount specified. + +\rule[raiseheight]{width}{thickness} *\rule* + The |\rule| command is used to produce horizontal lines. The + arguments are defined as follows: +'raiseheight' specifies how high to raise the rule (optional) +'width' specifies the length of the rule (mandatory) +'thickness' specifies the thickness of the rule (mandatory) + +\savebox{cmd}[width][pos]{text} *\savebox* + This command typeset text in a box just as for |\makebox|. + However, instead of printing the resulting box, it saves it in + bin cmd, which must have been declared with |\newsavebox|. + +\sbox{text} *\sbox* + This commands typeset text in a box just as for |\mbox|. + However, instead of printing the resulting box, it saves it in + bin cmd, which must have been declared with |\newsavebox|. + +\usebox{cmd} *\usebox* + Prints the box most recently saved in bin cmd by a |\savebox| + command. + +============================================================================== +19. Special Characters *latex-special* + +The following characters play a special role in LaTeX and are called "special +printing characters", or simply "special characters". > + # $ % & ~ _ ^ \ { } +Whenever you put one of these special characters into your file, you are doing +something special. If you simply want the character to be printed just as any +other letter, include a \ in front of the character. For example, \$ will +produce $ in your output. + +One exception to this rule is the \ itself because |\\| has its own special +meaning. A \ is produced by typing $\backslash$ in your file. + +Also, \~ means `place a tilde accent over the following letter', so you will +probably want to use |\verb| instead. + *\symbol* +In addition, you can access any character of a font once you know its number +by using the |\symbol| command. For example, the character used for displaying +spaces in the |\verb|* command has the code decimal 32, so it can be typed as +\symbol{32}. + +You can also specify octal numbers with ' or hexadecimal numbers with ", so +the previous example could also be written as \symbol{'40} or \symbol{"20}. + +============================================================================== +20. Splitting the Input *latex-inputting* + +A large document requires a lot of input. Rather than putting the whole input +in a single large file, it's more efficient to split it into several smaller +ones. Regardless of how many separate files you use, there is one that is the +root file; it is the one whose name you type when you run LaTeX. + +|\include| Conditionally include a file +|\includeonly| Determine which files are included +|\input| Unconditionally include a file + +\include{file} *\include* + The \include command is used in conjunction with the + |\includeonly| command for selective inclusion of + files. The file argument is the first name of a file, + denoting `file.tex' . If file is one the file names in + the file list of the |\includeonly| command or if there + is no |\includeonly| command, the \include command is + equivalent to: > + \clearpage \input{file} \clearpage +< + except that if the file `file.tex' does not exist, + then a warning message rather than an error is + produced. If the file is not in the file list, the + \include command is equivalent to |\clearpage|. + + The |\include| command may not appear in the preamble or in a + file read by another |\include| command. + +\includeonly{filelist} *\includeonly* + The |\includeonly| command controls which files will be read in + by an |\include| command. {filelist} should be a + comma-separated list of filenames. Each filename must match + exactly a filename specified in a |\include| command. This + command can only appear in the preamble. + +\input{file} *\input* + The |\input| command causes the indicated file to be read and + processed, exactly as if its contents had been inserted in the + current file at that point. The file name may be a complete + file name with extension or just a first name, in which case + the file `file.tex' is used. +============================================================================== +21. Starting & Ending *latex-start-end* + +Your input file must contain the following commands as a minimum: +\documentclass{class} |\documentclass| +\begin{document} |\begin| +... your text goes here ... +\end{document} |\end| + +where the class selected is one of the valid classes for LaTeX. +See |\classes|for details of the various document classes. + +You may include other LaTeX commands between the |\documentclass| and the +\begin{document} commands (i.e., in the `preamble'). +============================================================================== +22. Table of Contents *latex-toc* + + *\tableofcontents* +A table of contents is produced with the |\tableofcontents| command. You put +the command right where you want the table of contents to go; LaTeX does the +rest for you. It produces a heading, but it does not automatically start a new +page. If you want a new page after the table of contents, include a |\newpage| +command after the |\tableofcontents| command. + + *\listoffigures* *\listoftables* +There are similar commands |\listoffigures| and |\listoftables| for producing a +list of figures and a list of tables, respectively. Everything works exactly +the same as for the table of contents. + + *\nofiles* +NOTE: If you want any of these items to be generated, you cannot have the +\nofiles command in your document. + +|\addcontentsline| Add an entry to table of contents etc. +|\addtocontents| Add text directly to table of contents file etc. + +\addcontentsline{file}{secunit}{entry} *\addcontentsline* + The |\addcontentsline| command adds an entry to the specified + list or table where: +{file} is the extension of the file on which information is to be + written: + toc (table of contents), + lof (list of figures), + lot (list of tables). +{secunit} controls the formatting of the entry. It should be one of the + following, depending upon the value of the file argument: + toc -- the name of the sectional unit, such as part or + subsection. + lof -- figure + lot -- table +{entry} is the text of the entry. + +\addtocontents{file}{text} *\addtocontents* + The |\addtocontents| command adds text (or formatting commands) + directly to the file that generates the table of contents or + list of figures or tables. +{file} is the extension of the file on which information is to be written: + toc (table of contents), + lof (list of figures), + lot (list of tables). +{text} is the information to be written. + +============================================================================== +23. Terminal Input/Output *latex-terminal* + +|\typein| Read text from the terminal. +|\typeout| Write text to the terminal. + +\typein[cmd]{msg} *\typein* + Prints {msg} on the terminal and causes LaTeX to stop and wait + for you to type a line of input, ending with return. If the + [cmd] argument is missing, the typed input is processed as if + it had been included in the input file in place of the + |\typein| command. If the [cmd] argument is present, it must be + a command name. This command name is then defined or redefined + to be the typed input. + +\typeout{msg} *\typeout* + Prints {msg} on the terminal and in the `.log' file. Commands + in {msg} that are defined with |\newcommand| or |\renewcommand| + are replaced by their definitions before being printed. + + *\space* +LaTeX's usual rules for treating multiple spaces as a single space and +ignoring spaces after a command name apply to {msg}. A |\space| command in {msg} +causes a single space to be printed. A ^^J in {msg} prints a newline. + +============================================================================== +24. Typefaces *latex-typefaces* + +The typeface is specified by giving the "size" and "style". A typeface is also +called a "font". +|font-styles| Select roman, italics etc. +|font-size| Select point size. +|font-lowlevelcommands| Commands for wizards. + +Styles *font-styles* + +The following type style commands are supported by LaTeX. + +These commands are used like: > + \textit{italics text}. +The corresponding command in parenthesis is the "declaration form", which +takes no arguments. The scope of the declaration form lasts until the next +type style command or the end of the current group. + +The declaration forms are cumulative; i.e., you can say: > + \sffamily\bfseries +to get sans serif boldface. + +You can also use the environment form of the declaration forms; e.g.: > + \begin{ttfamily}...\end{ttfamily}. +< +\textrm (\rmfamily) *\textrm* *\rmfamily* + Roman + +\textit (\itshape) *\textit* *\itshape* *\emph* + Emphasis (toggles between |\textit| and |\textrm|). + +\textmd (\mdseries) *\textmd* *\mdseries* + Medium weight (default). The opposite of boldface. + +\textbf (\bfseries) *\textbf* *\bfseries* + Boldface. + +\textup (\upshape) *\textup* *\upshape* + Upright (default). The opposite of slanted. + +\textsl (\slshape) *\textsl* *\slshape* + Slanted. + +\textsf (\sffamily) *\textsf* *\sffamily* + Sans serif. + +\textsc (\scshape) *\textsc* *\scshape* + Small caps. + +\texttt (\ttfamily) *\texttt* *\ttfamily* + Typewriter. + +\textnormal (\normalfont) *\textnormal* *\normalfont* + Main document font. + +\mathrm *\mathrm* + Roman, for use in math mode. + +\mathbf *\mathbf* + Boldface, for use in math mode. + +\mathsf *\mathsf* + Sans serif, for use in math mode. + +\mathtt *\mathtt* + Typewriter, for use in math mode. + +\mathit *\mathit* + Italics, for use in math mode, e.g. variable names with + several letters. + +\mathnormal *\mathnormal* + For use in math mode, e.g. inside another type style + declaration. + +\mathcal *\mathcal* + `Calligraphic' letters, for use in math mode. + + *\mathversion* +In addition, the command \mathversion{bold} can be used for switching to bold +letters and symbols in formulas. \mathversion{normal} restores the default. + +========== +Sizes *font-size* + +The following standard type size commands are supported by LaTeX. + +The commands as listed here are "declaration forms". The scope of the +declaration form lasts until the next type style command or the end of the +current group. + +You can also use the environment form of these commands; e.g. > + \begin{tiny}...\end{tiny} + +\tiny *\tiny* +\scriptsize *\scriptsize* +\footnotesize *\footnotesize* +\small *\small* +\normalsize(default) *\normalsize* +\large *\large* +\Large *\Large* +\LARGE *\LARGE* +\huge *\huge* +\Huge *\Huge* + +========== +Low-level font commands *font-lowlevelcommands* + +These commands are primarily intended for writers of macros and packages. The +commands listed here are only a subset of the available ones. For full +details, you should consult Chapter 7 of The LaTeX Companion. + +\fontencoding{enc} *\fontencoding* + Select font encoding. Valid encodings include OT1 and T1. + +\fontfamily{family} *\fontfamily* + Select font family. Valid families include: + cmr for Computer Modern Roman + cmss for Computer Modern Sans Serif + cmtt for Computer Modern Typewriter + and numerous others. + +\fontseries{series} *\fontseries* + Select font series. Valid series include: + m Medium (normal) + b Bold + c Condensed + bc Bold condensed + bx Bold extended + and various other combinations. + +\fontshape{shape} *\fontshape* + Select font shape. Valid shapes are: + n Upright (normal) + it Italic + sl Slanted (oblique) + sc Small caps + ui Upright italics + ol Outline + The two last shapes are not available for most font families. + +\fontsize{size}{skip} *\fontsize* + Set font size. The first parameter is the font size to switch + to; the second is the \baselineskip to use. The unit of both + parameters defaults to pt. A rule of thumb is that the + baselineskip should be 1.2 times the font size. + +\selectfont *\selectfont* + The changes made by calling the four font commands described + above do not come into effect until |\selectfont| is called. + +\usefont{enc}{family}{series}{shape} *\usefont* + Equivalent to calling |\fontencoding|, |\fontfamily|, + |\fontseries| and |\fontshape| with the given parameters, + followed by |\selectfont|. + +============================================================================== +25. Parameters *latex-parameters* + +The input file specification indicates the file to be formatted; TeX uses +`.tex' as a default file extension. If you omit the input file entirely, TeX +accepts input from the terminal. You specify command options by supplying a +string as a parameter to the command; e.g. > + + latex "\scrollmode\input foo.tex" + +will process `foo.tex' without pausing after every error. + +Output files are always created in the current directory. When you fail to +specify an input file name, TeX bases the output names on the file +specification associated with the logical name TEX_OUTPUT, typically +texput.log. + + vim:tw=78:ts=8:ft=help:norl: diff --git a/vim-latex/ftplugin/bib_latexSuite.vim b/vim-latex/ftplugin/bib_latexSuite.vim new file mode 100644 index 0000000..7a8d47d --- /dev/null +++ b/vim-latex/ftplugin/bib_latexSuite.vim @@ -0,0 +1,15 @@ +" File: bib_latexSuite.vim +" Author: Srinath Avadhanula +" License: Vim Charityware License +" Description: +" This file sources the bibtex.vim file distributed as part of latex-suite. +" That file sets up 3 maps BBB, BAS, and BBA which are easy wasy to type in +" bibliographic entries. +" + +" source main.vim because we need a few functions from it. +runtime ftplugin/latex-suite/main.vim +" Disable smart-quotes because we need to enter real quotes in bib files. +runtime ftplugin/latex-suite/bibtex.vim + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vim-latex/ftplugin/latex-suite/bibtex.vim b/vim-latex/ftplugin/latex-suite/bibtex.vim new file mode 100644 index 0000000..2cc8199 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/bibtex.vim @@ -0,0 +1,265 @@ +"============================================================================= +" File: bibtex.vim +" Function: BibT +" Author: Alan G Isaac <aisaac@american.edu> +" modified by Srinath Avadhanula for latex-suite. +" License: Vim Charityware license. +"============================================================================= + +" Fields: +" Define what field type each letter denotes {{{ +" +let s:w_standsfor = 'address' +let s:a_standsfor = 'author' +let s:b_standsfor = 'booktitle' +let s:c_standsfor = 'chapter' +let s:d_standsfor = 'edition' +let s:e_standsfor = 'editor' +let s:h_standsfor = 'howpublished' +let s:i_standsfor = 'institution' +let s:k_standsfor = 'isbn' +let s:j_standsfor = 'journal' +let s:m_standsfor = 'month' +let s:n_standsfor = 'number' +let s:o_standsfor = 'organization' +let s:p_standsfor = 'pages' +let s:q_standsfor = 'publisher' +let s:r_standsfor = 'school' +let s:s_standsfor = 'series' +let s:t_standsfor = 'title' +let s:u_standsfor = 'type' +let s:v_standsfor = 'volume' +let s:y_standsfor = 'year' +let s:z_standsfor = 'note' + +" }}} +" Define the fields required for the various entry types {{{ +" +" s:{type}_required defines the required fields +" s:{type}_optional1 defines common optional fields +" s:{type}_optional2 defines uncommmon optional fields +" s:{type}_retval defines the first line of the formatted bib entry. +" +let s:key='<+key+>' + +let s:{'article'}_required="atjy" +let s:{'article'}_optional1="vnpm" +let s:{'article'}_optional2="z" " z is note +let s:{'article'}_retval = '@ARTICLE{' . s:key . ','."\n" + +let s:{'book'}_required="aetqy" " requires author *or* editor +let s:{'book'}_optional1="wd" +let s:{'book'}_optional2="vnsmz" " w is address, d is edition +let s:{'book'}_extras="k" " isbn +let s:{'book'}_retval = '@BOOK{' . s:key . ','."\n" + +let s:{'booklet'}_required="t" +let s:{'booklet'}_optional1="ahy" +let s:{'booklet'}_optional2="wmz" " w is address +let s:{'booklet'}_retval = '@BOOKLET{' . s:key . ','."\n" + +let s:{'inbook'}_required="aetcpqy" +let s:{'inbook'}_optional1="w" " w is address +let s:{'inbook'}_optional2="vnsudmz" " d is edition +let s:{'inbook'}_extras="k" " isbn +let s:{'inbook'}_retval = '@INBOOK{' . s:key . ','."\n" + +let s:{'incollection'}_required="atbqy" " b is booktitle +let s:{'incollection'}_optional1="cpw" " w is address, c is chapter +let s:{'incollection'}_optional2="evnsudmz" " d is edition +let s:{'incollection'}_extras="k" " isbn +let s:{'incollection'}_retval = '@INCOLLECTION{' . s:key . ','."\n" + +let s:{'inproceedings'}_required="atby" " b is booktitle +let s:{'inproceedings'}_optional1="epwoq" " w is address, q is publisher +let s:{'inproceedings'}_optional2="vnsmz" +let s:{'inproceedings'}_extras="k" " isbn +let s:{'inproceedings'}_retval = '@INPROCEEDINGS{' . s:key . ','."\n" + +let s:{'conference'}_required="atby" " b is booktitle +let s:{'conference'}_optional1="epwoq" " w is address, q is publisher +let s:{'conference'}_optional2="vnsmz" +let s:{'conference'}_extras="k" " isbn +let s:{'conference'}_retval = '@CONFERENCE{' . s:key . ','."\n" + +let s:{'manual'}_required="t" +let s:{'manual'}_optional1="ow" +let s:{'manual'}_optional2="admyz" " w is address +let s:{'manual'}_retval = '@MANUAL{' . s:key . ','."\n" + +let s:{'msthesis'}_required="atry" " r is school +let s:{'msthesis'}_optional1="w" " w is address +let s:{'msthesis'}_optional2="umz" " u is type, w is address +let s:{'msthesis'}_retval = '@MASTERSTHESIS{' . s:key . ','."\n" + +let s:{'misc'}_required="" +let s:{'misc'}_optional1="ath" +let s:{'misc'}_optional2="myz" +let s:{'misc'}_retval = '@MISC{' . s:key . ','."\n" + +let s:{'phdthesis'}_required="atry" " r is school +let s:{'phdthesis'}_optional1="w" " w is address +let s:{'phdthesis'}_optional2="umz" " u is type +let s:{'phdthesis'}_retval = '@PHDTHESIS{' . s:key . ','."\n" + +let s:{'proceedings'}_required="ty" +let s:{'proceedings'}_optional1="ewo" " w is address +let s:{'proceedings'}_optional2="vnsmqz" " q is publisher +let s:{'proceedings'}_retval = '@PROCEEDINGS{' . s:key . ','."\n" + +let s:{'techreport'}_required="atiy" +let s:{'techreport'}_optional1="unw" " u is type, w is address +let s:{'techreport'}_optional2="mz" +let s:{'techreport'}_retval = '@TECHREPORT{' . s:key . ','."\n" + +let s:{'unpublished'}_required="atz" +let s:{'unpublished'}_optional1="y" +let s:{'unpublished'}_optional2="m" +let s:{'unpublished'}_retval = '@UNPUBLISHED{' . s:key . ','."\n" + +" }}} + +if exists('s:done') + finish +endif +let s:done = 1 + +call IMAP ('BBB', "\<C-r>=BibT('', '', 0)\<CR>", 'bib') +call IMAP ('BBL', "\<C-r>=BibT('', 'o', 0)\<CR>", 'bib') +call IMAP ('BBH', "\<C-r>=BibT('', 'O', 0)\<CR>", 'bib') +call IMAP ('BBX', "\<C-r>=BibT('', 'Ox', 0)\<CR>", 'bib') + +" BibT: function to generate a formatted bibtex entry {{{ +" three sample usages: +" :call BibT() will request type choice +" :call BibT("article") preferred, provides most common fields +" :call BibT("article","ox") more optional fields (o) and extras (x) +" +" Input Arguments: +" type: is one of the types listed above. (this should be a complete name, not +" the acronym). +" options: a string containing 0 or more of the letters 'oOx' +" where +" o: include a bib entry with first set of options +" O: include a bib entry with extended options +" x: incude bib entry with extra options +" prompt: whether the fields are asked to be filled on the command prompt or +" whether place-holders are used. when prompt == 1, then comman line +" questions are used. +" +" Returns: +" a string containing a formatted bib entry +function BibT(type, options, prompt) + if a:type != '' + let choosetype = a:type + else + let types = + \ 'article'."\n". + \ 'booklet'."\n". + \ 'book'."\n". + \ 'conference'."\n". + \ 'inbook'."\n". + \ 'incollection'."\n". + \ 'inproceedings'."\n". + \ 'manual'."\n". + \ 'msthesis'."\n". + \ 'misc'."\n". + \ 'phdthesis'."\n". + \ 'proceedings'."\n". + \ 'techreport'."\n". + \ 'unpublished' + let choosetype = Tex_ChooseFromPrompt( + \ "Choose the type of bibliographic entry: \n" . + \ Tex_CreatePrompt(types, 3, "\n") . + \ "\nEnter number or filename :", + \ types, "\n") + if choosetype == '' + let choosetype = 'article' + endif + if types !~ '^\|\n'.choosetype.'$\|\n' + echomsg 'Please choose only one of the given types' + return + endif + endif + if a:options != '' + let options = a:options + else + let options = "" + endif + + let fields = '' + let extras="" + let retval = "" + + " define fields + let fields = s:{choosetype}_required + if options =~ 'o' && exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + if options =~ "O" && exists('s:'.choosetype.'_optional2') + if options !~ 'o'&& exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + let fields = fields . s:{choosetype}_optional2 + endif + if options =~ "x" && exists('s:'.choosetype.'_extras') + let fields = fields . extras + endif + if exists('g:Bib_'.choosetype.'_options') + let fields = fields . g:Bib_{choosetype}_options + endif + + let retval = s:{choosetype}_retval + + let i = 0 + while i < strlen(fields) + let field = strpart(fields, i, 1) + + if exists('s:'.field.'_standsfor') + let field_name = s:{field}_standsfor + let retval = retval.field_name." = {<++>},\n" + endif + + let i = i + 1 + endwhile + + " If the user wants even more fine-tuning... + if Tex_GetVarValue('Bib_'.choosetype.'_extrafields') != '' + + let extrafields = Tex_GetVarValue('Bib_'.choosetype.'_extrafields') + + let i = 1 + while 1 + let field_name = Tex_Strntok(extrafields, "\n", i) + if field_name == '' + break + endif + + let retval = retval.field_name." = {<++>},\n" + + let i = i + 1 + endwhile + + endif + + let retval = retval.'otherinfo = {<++>}'."\n" + let retval = retval."}<++>"."\n" + + return IMAP_PutTextWithMovement(retval) +endfunction + +" }}} +function! s:Input(prompt, ask) " {{{ + if a:ask == 1 + let retval = input(a:prompt) + if retval == '' + return "<++>" + endif + else + return "<++>" + endif +endfunction + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/bibtools.py b/vim-latex/ftplugin/latex-suite/bibtools.py new file mode 100644 index 0000000..b5f7842 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/bibtools.py @@ -0,0 +1,221 @@ +# Author: Srinath Avadhanula +# This file is distributed as part of the vim-latex project +# http://vim-latex.sf.net + +import re + +class Bibliography(dict): + def __init__(self, txt, macros={}): + """ + txt: + a string which represents the entire bibtex entry. A typical + entry is of the form: + @ARTICLE{ellington:84:part3, + author = {Ellington, C P}, + title = {The Aerodynamics of Hovering Insect Flight. III. Kinematics}, + journal = {Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences}, + year = {1984}, + volume = {305}, + pages = {41-78}, + number = {1122}, + owner = {Srinath}, + pdf = {C:\srinath\research\papers\Ellington-3-Kinematics.pdf}, + timestamp = {2006.01.02}, + } + """ + + if macros: + for k, v in macros.iteritems(): + txt = txt.replace(k, '{'+v+'}') + + m = re.match(r'\s*@(\w+){((\S+),)?(.*)}\s*', txt, re.MULTILINE | re.DOTALL) + if not m: + return None + + self['bibtype'] = m.group(1).capitalize() + self['key'] = m.group(3) + self['body'] = m.group(4) + + body = self['body'] + self['bodytext'] = '' + while 1: + m = re.search(r'(\S+?)\s*=\s*(.)', body) + if not m: + break + + field = m.group(1) + + body = body[(m.start(2)+1):] + if m.group(2) == '{': + # search for the next closing brace. This is not simply a + # matter of searching for the next closing brace since + # braces can be nested. The following code basically goes + # to the next } which has not already been closed by a + # following {. + mniter = re.finditer(r'{|}', body) + + count = 1 + while 1: + try: + mn = mniter.next() + except StopIteration: + return None + + if mn.group(0) == '{': + count += 1 + else: + count -= 1 + + if count == 0: + value = body[:(mn.start(0))] + break + + elif m.group(2) == '"': + # search for the next unquoted double-quote. To be more + # precise, a double quote which is preceded by an even + # number of double quotes. + mn = re.search(r'(?!\\)(\\\\)*"', body) + if not mn: + return None + + value = body[:(mn.start(0))] + + else: + # $ always matches. So we do not need to do any + # error-checking. + mn = re.search(r',|$', body) + value = m.group(2) + body[:(mn.start(0))].rstrip() + + self[field.lower()] = re.sub(r'\s+', ' ', value) + body = body[(mn.start(0)+1):] + + self['bodytext'] += (' %s: %s\n' % (field, value)) + if self['bibtype'].lower() == 'string': + self['macro'] = {field: value} + + self['bodytext'] = self['bodytext'].rstrip() + + + def __getitem__(self, key): + try: + return dict.__getitem__(self, key) + except KeyError: + return '' + + def __str__(self): + if self['bibtype'].lower() == 'string': + return 'String: %(macro)s' % self + + elif self['bibtype'].lower() == 'article': + return ('Article [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(journal)s, %(year)s') % self + + elif self['bibtype'].lower() == 'conference': + return ('Conference [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(booktitle)s, %(year)s') % self + + elif self['bibtype'].lower() == 'mastersthesis': + return ('Masters [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'phdthesis': + return ('PhD [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'book': + return ('Book [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN %(publisher)s, %(year)s') % self + + else: + s = '%(bibtype)s [%(key)s]\n' % self + if self['title']: + s += 'TI "%(title)s"\n' % self + if self['author']: + s += 'AU %(author)s\n' % self + for k, v in self.iteritems(): + if k not in ['title', 'author', 'bibtype', 'key', 'id', 'file', 'body', 'bodytext']: + s += 'MI %s: %s\n' % (k, v) + + return s.rstrip() + + def satisfies(self, filters): + for field, regexp in filters: + if not re.search(regexp, self[field], re.I): + return False + + return True + +class BibFile: + + def __init__(self, filelist=''): + self.bibentries = [] + self.filters = [] + self.macros = {} + self.sortfields = [] + if filelist: + for f in filelist.splitlines(): + self.addfile(f) + + def addfile(self, file): + fields = open(file).read().split('@') + for f in fields: + if not (f and re.match('string', f, re.I)): + continue + + b = Bibliography('@' + f) + self.macros.update(b['macro']) + + for f in fields: + if not f or re.match('string', f, re.I): + continue + + b = Bibliography('@' + f, self.macros) + if b: + b['file'] = file + b['id'] = len(self.bibentries) + self.bibentries += [b] + + + def addfilter(self, filterspec): + self.filters += [filterspec.split()] + + def rmfilters(self): + self.filters = [] + + def __str__(self): + s = '' + for b in self.bibentries: + if b['key'] and b.satisfies(self.filters): + s += '%s\n\n' % b + return s + + def addsortfield(self, field): + self.sortfields += [field] + + def rmsortfields(self): + self.sortfields = [] + + def sort(self): + def cmpfun(b1, b2): + for f in self.sortfields: + c = cmp(b1[f], b2[f]) + if c: + return c + return 0 + self.bibentries.sort(cmp=cmpfun) + +if __name__ == "__main__": + import sys + + bf = BibFile(sys.argv[1]) + print bf diff --git a/vim-latex/ftplugin/latex-suite/brackets.vim b/vim-latex/ftplugin/latex-suite/brackets.vim new file mode 100644 index 0000000..e1d69ae --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/brackets.vim @@ -0,0 +1,144 @@ +" ============================================================================== +" History: This was originally part of auctex.vim by Carl Mueller. +" Srinath Avadhanula incorporated it into latex-suite with +" significant modifications. +" Parts of this file may be copyrighted by others as noted. +" Description: +" This ftplugin provides the following maps: +" . <M-b> encloses the previous character in \mathbf{} +" . <M-c> is polymorphic as follows: +" Insert mode: +" 1. If the previous character is a letter or number, then capitalize it and +" enclose it in \mathcal{} +" 2. otherwise insert \cite{} +" Visual Mode: +" 1. Enclose selection in \mathcal{} +" . <M-l> is also polymorphic as follows: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(\right +" similarly for [, | +" {<M-l> \left\{\right\} +" 2. <<M-l> \langle\rangle +" 3. q<M-l> \lefteqn{} +" otherwise insert \label{} +" . <M-i> inserts \item commands at the current cursor location depending on +" the surrounding environment. For example, inside itemize, it will +" insert a simple \item, but within a description, it will insert +" \item[<+label+>] etc. +" +" These functions make it extremeley easy to do all the \left \right stuff in +" latex. +" ============================================================================== + +" Avoid reinclusion. +if exists('b:did_brackets') + finish +endif +let b:did_brackets = 1 + +" define the funtions only once. +if exists('*Tex_MathBF') + finish +endif + +" Tex_MathBF: encloses te previous letter/number in \mathbf{} {{{ +" Description: +function! Tex_MathBF() + return "\<Left>\\mathbf{\<Right>}" +endfunction " }}} +" Tex_MathCal: enclose the previous letter/number in \mathcal {{{ +" Description: +" if the last character is not a letter/number, then insert \cite{} +function! Tex_MathCal() + let line = getline(line(".")) + let char = line[col(".")-2] + + if char =~ '[a-zA-Z0-9]' + return "\<BS>".'\mathcal{'.toupper(char).'}' + else + return IMAP_PutTextWithMovement('\cite{<++>}<++>') + endif +endfunction +" }}} +" Tex_LeftRight: maps <M-l> in insert mode. {{{ +" Description: +" This is a polymorphic function, which maps the behaviour of <M-l> in the +" following way: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(<++>\right<++> +" similarly for [, | +" {<M-l> \left\{<++>\right\}<++> +" 2. <<M-l> \langle<++>\rangle<++> +" 3. q<M-l> \lefteqn{<++>}<++> +" otherwise insert \label{<++>}<++> +function! Tex_LeftRight() + let line = getline(line(".")) + let char = line[col(".")-2] + let previous = line[col(".")-3] + + let matchedbrackets = '()[]{}||' + if char =~ '(\|\[\|{\||' + let add = '' + if char =~ '{' + let add = "\\" + endif + let rhs = matchstr(matchedbrackets, char.'\zs.\ze') + return "\<BS>".IMAP_PutTextWithMovement('\left'.add.char.'<++>\right'.add.rhs.'<++>') + elseif char == '<' + return "\<BS>".IMAP_PutTextWithMovement('\langle <++>\rangle<++>') + elseif char == 'q' + return "\<BS>".IMAP_PutTextWithMovement('\lefteqn{<++>}<++>') + else + return IMAP_PutTextWithMovement('\label{<++>}<++>') + endif +endfunction " }}} +" Tex_PutLeftRight: maps <M-l> in normal mode {{{ +" Description: +" Put \left...\right in front of the matched brackets. +function! Tex_PutLeftRight() + let previous = getline(line("."))[col(".") - 2] + let char = getline(line("."))[col(".") - 1] + if previous == '\' + if char == '{' + exe "normal ileft\\\<Esc>l%iright\\\<Esc>l%" + elseif char == '}' + exe "normal iright\\\<Esc>l%ileft\\\<Esc>l%" + endif + elseif char =~ '\[\|(' + exe "normal i\\left\<Esc>l%i\\right\<Esc>l%" + elseif char =~ '\]\|)' + exe "normal i\\right\<Esc>l%i\\left\<Esc>l%" + endif +endfunction " }}} + +" Provide <plug>'d mapping for easy user customization. {{{ +inoremap <silent> <Plug>Tex_MathBF <C-r>=Tex_MathBF()<CR> +inoremap <silent> <Plug>Tex_MathCal <C-r>=Tex_MathCal()<CR> +inoremap <silent> <Plug>Tex_LeftRight <C-r>=Tex_LeftRight()<CR> +vnoremap <silent> <Plug>Tex_MathBF <C-C>`>a}<Esc>`<i\mathbf{<Esc> +vnoremap <silent> <Plug>Tex_MathCal <C-C>`>a}<Esc>`<i\mathcal{<Esc> +nnoremap <silent> <Plug>Tex_LeftRight :call Tex_PutLeftRight()<CR> + +" }}} +" Tex_SetBracketingMaps: create mappings for the current buffer {{{ +function! <SID>Tex_SetBracketingMaps() + + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'i', '<buffer> <silent>') + call Tex_MakeMap('<M-b>', '<Plug>Tex_MathBF', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-c>', '<Plug>Tex_MathCal', 'v', '<buffer> <silent>') + call Tex_MakeMap('<M-l>', '<Plug>Tex_LeftRight', 'n', '<buffer> <silent>') + +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('brackets.vim: Catching LatexSuiteFileType event', 'brak') | + \ call <SID>Tex_SetBracketingMaps() +augroup END + +" vim:fdm=marker diff --git a/vim-latex/ftplugin/latex-suite/compiler.vim b/vim-latex/ftplugin/latex-suite/compiler.vim new file mode 100644 index 0000000..08b0509 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/compiler.vim @@ -0,0 +1,875 @@ +"============================================================================= +" File: compiler.vim +" Author: Srinath Avadhanula +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions for compiling/viewing/searching latex documents +"============================================================================= + +" Tex_SetTeXCompilerTarget: sets the 'target' for the next call to Tex_RunLaTeX() {{{ +function! Tex_SetTeXCompilerTarget(type, target) + call Tex_Debug("+Tex_SetTeXCompilerTarget: setting target to [".a:target."] for ".a:type."r", "comp") + + if a:target == '' + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for '.a:type.'r: ', target) + else + let target = a:target + endif + if target == '' + let target = 'dvi' + endif + + let targetRule = Tex_GetVarValue('Tex_'.a:type.'Rule_'.target) + + if targetRule != '' + if a:type == 'Compile' + let &l:makeprg = escape(targetRule, Tex_GetVarValue('Tex_EscapeChars')) + elseif a:type == 'View' + let s:viewer = targetRule + endif + let s:target = target + + elseif Tex_GetVarValue('Tex_'.a:type.'RuleComplete_'.target) != '' + let s:target = target + + elseif a:type == 'View' && has('macunix') + " On the mac, we can have empty view rules, so do not complain when + " both Tex_ViewRule_target and Tex_ViewRuleComplete_target are + " empty. On other platforms, we will complain... see below. + let s:target = target + + else + let s:origdir = fnameescape(getcwd()) + exe 'cd '.fnameescape(expand('%:p:h')) + if !Tex_GetVarValue('Tex_UseMakefile') || (glob('makefile*') == '' && glob('Makefile*') == '') + if has('gui_running') + call confirm( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information', + \"&ok", 1, 'Warning') + else + call input( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information' + \) + endif + else + echomsg 'Assuming target is for makefile' + let s:target = target + endif + exe 'cd '.s:origdir + endif +endfunction + +function! SetTeXTarget(...) + if a:0 < 1 + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for compiler and viewer: ', target) + else + let target = a:1 + endif + if target == '' + let target = 'dvi' + endif + + call Tex_SetTeXCompilerTarget('Compile', target) + call Tex_SetTeXCompilerTarget('View', target) +endfunction + +com! -nargs=1 TCTarget :call Tex_SetTeXCompilerTarget('Compile', <f-args>) +com! -nargs=1 TVTarget :call Tex_SetTeXCompilerTarget('View', <f-args>) +com! -nargs=? TTarget :call SetTeXTarget(<f-args>) + +" }}} +" Tex_CompileLatex: compiles the present file. {{{ +" Description: +function! Tex_CompileLatex() + if &ft != 'tex' + echo "calling Tex_RunLaTeX from a non-tex file" + return + end + + " close any preview windows left open. + pclose! + + let s:origdir = fnameescape(getcwd()) + + " Find the main file corresponding to this file. Always cd to the + " directory containing the file to avoid problems with the directory + " containing spaces. + " Latex on linux seems to be unable to handle file names with spaces at + " all! Therefore for the moment, do not attempt to handle spaces in the + " file name. + if exists('b:fragmentFile') + let mainfname = expand('%:p:t') + call Tex_CD(expand('%:p:h')) + else + let mainfname = Tex_GetMainFileName(':p:t') + call Tex_CD(Tex_GetMainFileName(':p:h')) + end + + call Tex_Debug('Tex_CompileLatex: getting mainfname = ['.mainfname.'] from Tex_GetMainFileName', 'comp') + + " if a makefile exists and the user wants to use it, then use that + " irrespective of whether *.latexmain exists or not. mainfname is still + " extracted from *.latexmain (if possible) log file name depends on the + " main file which will be compiled. + if Tex_GetVarValue('Tex_UseMakefile') && (glob('makefile') != '' || glob('Makefile') != '') + let _makeprg = &l:makeprg + call Tex_Debug("Tex_CompileLatex: using the makefile in the current directory", "comp") + let &l:makeprg = 'make $*' + if exists('s:target') + call Tex_Debug('Tex_CompileLatex: execing [make! '.s:target.']', 'comp') + exec 'make! '.s:target + else + call Tex_Debug('Tex_CompileLatex: execing [make!]', 'comp') + exec 'make!' + endif + let &l:makeprg = _makeprg + else + " If &makeprg has something like "$*.ps", it means that it wants the + " file-name without the extension... Therefore remove it. + if &makeprg =~ '\$\*\.\w\+' + let mainfname = fnamemodify(mainfname, ':r') + endif + call Tex_Debug('Tex_CompileLatex: execing [make! '.mainfname.']', 'comp') + exec 'make! '.mainfname + endif + redraw! + + exe 'cd '.s:origdir +endfunction " }}} +" Tex_RunLaTeX: compilation function {{{ +" this function runs the latex command on the currently open file. often times +" the file being currently edited is only a fragment being \input'ed into some +" master tex file. in this case, make a file called mainfile.latexmain in the +" directory containig the file. in other words, if the current file is +" ~/thesis/chapter.tex +" so that doing "latex chapter.tex" doesnt make sense, then make a file called +" main.tex.latexmain +" in the ~/thesis directory. this will then run "latex main.tex" when +" Tex_RunLaTeX() is called. +function! Tex_RunLaTeX() + call Tex_Debug('+Tex_RunLaTeX, b:fragmentFile = '.exists('b:fragmentFile'), 'comp') + + let dir = expand("%:p:h").'/' + let s:origdir = fnameescape(getcwd()) + call Tex_CD(expand("%:p:h")) + + let initTarget = s:target + + " first get the dependency chain of this format. + call Tex_Debug("Tex_RunLaTeX: compiling to target [".s:target."]", "comp") + + if Tex_GetVarValue('Tex_FormatDependency_'.s:target) != '' + let dependency = Tex_GetVarValue('Tex_FormatDependency_'.s:target) + if dependency !~ ','.s:target.'$' + let dependency = dependency.','.s:target + endif + else + let dependency = s:target + endif + + call Tex_Debug('Tex_RunLaTeX: getting dependency chain = ['.dependency.']', 'comp') + + " now compile to the final target format via each dependency. + let i = 1 + while Tex_Strntok(dependency, ',', i) != '' + let s:target = Tex_Strntok(dependency, ',', i) + + call Tex_SetTeXCompilerTarget('Compile', s:target) + call Tex_Debug('Tex_RunLaTeX: setting target to '.s:target, 'comp') + + if Tex_GetVarValue('Tex_MultipleCompileFormats') =~ '\<'.s:target.'\>' + call Tex_Debug("Tex_RunLaTeX: compiling file multiple times via Tex_CompileMultipleTimes", "comp") + call Tex_CompileMultipleTimes() + else + call Tex_Debug("Tex_RunLaTeX: compiling file once via Tex_CompileLatex", "comp") + call Tex_CompileLatex() + endif + + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_RunLaTeX: errlist = [".errlist."]", "comp") + + " If there are any errors, then break from the rest of the steps + if errlist =~ '\v(error|warning)' + call Tex_Debug('Tex_RunLaTeX: There were errors in compiling, breaking chain...', 'comp') + break + endif + + let i = i + 1 + endwhile + + let s:target = initTarget + let s:origwinnum = winnr() + call Tex_SetupErrorWindow() + + exe 'cd '.s:origdir + call Tex_Debug("-Tex_RunLaTeX", "comp") +endfunction + +" }}} +" Tex_ViewLaTeX: opens viewer {{{ +" Description: opens the DVI viewer for the file being currently edited. +" Again, if the current file is a \input in a master file, see text above +" Tex_RunLaTeX() to see how to set this information. +function! Tex_ViewLaTeX() + if &ft != 'tex' + echo "calling Tex_ViewLaTeX from a non-tex file" + return + end + + let s:origdir = fnameescape(getcwd()) + + " If b:fragmentFile is set, it means this file was compiled as a fragment + " using Tex_PartCompile, which means that we want to ignore any + " *.latexmain or makefile's. + if !exists('b:fragmentFile') + " cd to the location of the file to avoid having to deal with spaces + " in the directory name. + let mainfname = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + else + let mainfname = expand("%:p:t:r") + call Tex_CD(expand("%:p:h")) + endif + + if Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) != '' + + let execString = Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) + let execString = substitute(execString, '{v:servername}', v:servername, 'g') + + elseif has('win32') + " unfortunately, yap does not allow the specification of an external + " editor from the command line. that would have really helped ensure + " that this particular vim and yap are connected. + let execString = 'start '.s:viewer.' "$*.'.s:target.'"' + + elseif (has('macunix') && Tex_GetVarValue('Tex_TreatMacViewerAsUNIX') != 1) + + if strlen(s:viewer) + let appOpt = '-a ' + else + let appOpt = '' + endif + let execString = 'open '.appOpt.s:viewer.' $*.'.s:target + + else + " taken from Dimitri Antoniou's tip on vim.sf.net (tip #225). + " slight change to actually use the current servername instead of + " hardcoding it as xdvi. + " Using an option for specifying the editor in the command line + " because that seems to not work on older bash'es. + if s:target == 'dvi' + + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ v:servername != '' && + \ (s:viewer == "xdvi" || s:viewer == "xdvik") + + let execString = s:viewer.' -editor "gvim --servername '.v:servername. + \ ' --remote-silent +\%l \%f" $*.dvi' + + elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ s:viewer == "kdvi" + + let execString = 'kdvi --unique $*.dvi' + + else + + let execString = s:viewer.' $*.dvi' + + endif + + else + + let execString = s:viewer.' $*.'.s:target + + endif + + if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 ) + let execString = execString.' &' + endif + + end + + let execString = substitute(execString, '\V$*', mainfname, 'g') + call Tex_Debug("Tex_ViewLaTeX: execString = ".execString, "comp") + + exec 'silent! !'.execString + + if !has('gui_running') + redraw! + endif + + exe 'cd '.s:origdir +endfunction + +" }}} +" Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{ +" Description: if the DVI viewer is compatible, then take the viewer to that +" position in the dvi file. see docs for Tex_RunLaTeX() to set a +" master file if this is an \input'ed file. +" Tip: With YAP on Windows, it is possible to do forward and inverse searches +" on DVI files. to do forward search, you'll have to compile the file +" with the --src-specials option. then set the following as the command +" line in the 'view/options/inverse search' dialog box: +" gvim --servername LATEX --remote-silent +%l "%f" +" For inverse search, if you are reading this, then just pressing \ls +" will work. +function! Tex_ForwardSearchLaTeX() + if &ft != 'tex' + echo "calling Tex_ForwardSeachLaTeX from a non-tex file" + return + end + + if Tex_GetVarValue('Tex_ViewRule_'.s:target) == '' + return + endif + let viewer = Tex_GetVarValue('Tex_ViewRule_'.s:target) + + let s:origdir = fnameescape(getcwd()) + + let mainfname = Tex_GetMainFileName(':t') + let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r') + let mainfnameFull = Tex_GetMainFileName(':p:r') + " cd to the location of the file to avoid problems with directory name + " containing spaces. + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's + " tips on vim.sf.net (vim.sf.net tip #225) + if (has('win32') && (viewer ==? "yap")) + + let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%').' '.mainfnameRoot + + + elseif (has('macunix') && (viewer == "Skim" || viewer == "PDFView" || viewer == "TeXniscope")) + " We're on a Mac using a traditional Mac viewer + + if viewer == "Skim" + + let execString = 'silent! !/Applications/Skim.app/Contents/SharedSupport/displayline '. + \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"' + + elseif viewer == "PDFView" + + let execString = 'silent! !/Applications/PDFView.app/Contents/MacOS/gotoline.sh '. + \ line('.').' "'.mainfnameFull.'.'.s:target.'" "'.expand("%:p").'"' + + elseif viewer == "TeXniscope" + + let execString = 'silent! !/Applications/TeXniscope.app/Contents/Resources/forward-search.sh '. + \ line('.').' "'.expand("%:p").'" "'.mainfnameFull.'.'.s:target.'"' + + endif + + else + " We're either UNIX or Mac and using a UNIX-type viewer + + " Check for the special DVI viewers first + if (viewer == "xdvi" || viewer == "xdvik" || viewer == "kdvi" || viewer == "okular") + + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ exists('v:servername') && + \ (viewer == "xdvi" || viewer == "xdvik") + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition "'.line('.').' '.expand("%").'"'. + \ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '. + \ mainfnameRoot.'.dvi' + + elseif viewer == "kdvi" + + let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%") + + elseif (viewer == "xdvi" || viewer == "xdvik" ) + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition "'.line('.').' '.expand("%").'" '.mainfnameRoot.'.dvi' + + elseif viewer == "okular" + + let execString = 'silent! !okular '.mainfnameRoot.'.dvi\#src:'.line('.').expand("%") + + + endif + + else + " We must be using a generic UNIX viewer + " syntax is: viewer TARGET_FILE LINE_NUMBER SOURCE_FILE + + let execString = 'silent! !'.viewer.' "'.mainfnameRoot.'.'.s:target.'" '.line('.').' "'.expand('%').'"' + + endif + + " See if we should add &. On Mac (at least in MacVim), it seems + " like this should NOT be added... + if( Tex_GetVarValue('Tex_ExecuteUNIXViewerInForeground') != 1 ) + let execString = execString.' &' + endif + + endif + + call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp") + execute execString + if !has('gui_running') + redraw! + endif + + exe 'cd '.s:origdir +endfunction + +" }}} + +" ============================================================================== +" Functions for compiling parts of a file. +" ============================================================================== +" Tex_PartCompile: compiles selected fragment {{{ +" Description: creates a temporary file from the selected fragment of text +" prepending the preamble and \end{document} and then asks Tex_RunLaTeX() to +" compile it. +function! Tex_PartCompile() range + call Tex_Debug('+Tex_PartCompile', 'comp') + + " Get a temporary file in the same directory as the file from which + " fragment is being extracted. This is to enable the use of relative path + " names in the fragment. + let tmpfile = Tex_GetTempName(expand('%:p:h')) + + " Remember all the temp files and for each temp file created, remember + " where the temp file came from. + let s:Tex_NumTempFiles = (exists('s:Tex_NumTempFiles') ? s:Tex_NumTempFiles + 1 : 1) + let s:Tex_TempFiles = (exists('s:Tex_TempFiles') ? s:Tex_TempFiles : '') + \ . tmpfile."\n" + let s:Tex_TempFile_{s:Tex_NumTempFiles} = tmpfile + " TODO: For a function Tex_RestoreFragment which restores a temp file to + " its original location. + let s:Tex_TempFileOrig_{s:Tex_NumTempFiles} = expand('%:p') + let s:Tex_TempFileRange_{s:Tex_NumTempFiles} = a:firstline.','.a:lastline + + " Set up an autocmd to clean up the temp files when Vim exits. + if Tex_GetVarValue('Tex_RemoveTempFiles') + augroup RemoveTmpFiles + au! + au VimLeave * :call Tex_RemoveTempFiles() + augroup END + endif + + " If mainfile exists open it in tiny window and extract preamble there, + " otherwise do it from current file + let mainfile = Tex_GetMainFileName(":p") + exe 'bot 1 split '.escape(mainfile, ' ') + exe '1,/\s*\\begin{document}/w '.tmpfile + wincmd q + + exe a:firstline.','.a:lastline."w! >> ".tmpfile + + " edit the temporary file + exec 'drop '.tmpfile + + " append the \end{document} line. + $ put ='\end{document}' + w + + " set this as a fragment file. + let b:fragmentFile = 1 + + silent! call Tex_RunLaTeX() +endfunction " }}} +" Tex_RemoveTempFiles: cleans up temporary files created during part compilation {{{ +" Description: During part compilation, temporary files containing the +" visually selected text are created. These files need to be +" removed when Vim exits to avoid "file leakage". +function! Tex_RemoveTempFiles() + if !exists('s:Tex_NumTempFiles') || !Tex_GetVarValue('Tex_RemoveTempFiles') + return + endif + let i = 1 + while i <= s:Tex_NumTempFiles + let tmpfile = s:Tex_TempFile_{i} + " Remove the tmp file and all other associated files such as the + " .log files etc. + call Tex_DeleteFile(fnamemodify(tmpfile, ':p:r').'.*') + let i = i + 1 + endwhile +endfunction " }}} + +" ============================================================================== +" Compiling a file multiple times to resolve references/citations etc. +" ============================================================================== +" Tex_CompileMultipleTimes: The main function {{{ +" Description: compiles a file multiple times to get cross-references right. +function! Tex_CompileMultipleTimes() + " Just extract the root without any extension because we want to construct + " the log file names etc from it. + let s:origdir = fnameescape(getcwd()) + let mainFileName_root = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " First ignore undefined references and the + " "rerun to get cross-references right" message from + " the compiler output. + let origlevel = Tex_GetVarValue('Tex_IgnoreLevel') + let origpats = Tex_GetVarValue('Tex_IgnoredWarnings') + + let g:Tex_IgnoredWarnings = g:Tex_IgnoredWarnings."\n" + \ . 'Reference %.%# undefined'."\n" + \ . 'Rerun to get cross-references right' + TCLevel 1000 + + let idxFileName = mainFileName_root.'.idx' + let auxFileName = mainFileName_root.'.aux' + + let runCount = 0 + let needToRerun = 1 + while needToRerun == 1 && runCount < 5 + " assume we need to run only once. + let needToRerun = 0 + + let idxlinesBefore = Tex_CatFile(idxFileName) + let auxlinesBefore = Tex_GetAuxFile(auxFileName) + + " first run latex. + echomsg "latex run number : ".(runCount+1) + call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp") + silent! call Tex_CompileLatex() + + " If there are errors in any latex compilation step, immediately + " return. For now, do not bother with warnings because those might go + " away after compiling again or after bibtex is run etc. + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_CompileMultipleTimes: errors = [".errlist."]", "comp") + + if errlist =~ 'error' + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + + return + endif + + let idxlinesAfter = Tex_CatFile(idxFileName) + + " If .idx file changed, then run makeindex to generate the new .ind + " file and remember to rerun latex. + if runCount == 0 && glob(idxFileName) != '' && idxlinesBefore != idxlinesAfter + echomsg "Running makeindex..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_MakeIndexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let needToRerun = 1 + endif + + " The first time we see if we need to run bibtex and if the .bbl file + " changes, we will rerun latex. + if runCount == 0 && Tex_IsPresentInFile('\\bibdata', mainFileName_root.'.aux') + let bibFileName = mainFileName_root.'.bbl' + + let biblinesBefore = Tex_CatFile(bibFileName) + + echomsg "Running '".Tex_GetVarValue('Tex_BibtexFlavor')."' ..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_BibtexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let biblinesAfter = Tex_CatFile(bibFileName) + + " If the .bbl file changed after running bibtex, we need to + " latex again. + if biblinesAfter != biblinesBefore + echomsg 'Need to rerun because bibliography file changed...' + call Tex_Debug('Tex_CompileMultipleTimes: Need to rerun because bibliography file changed...', 'comp') + let needToRerun = 1 + endif + endif + + " check if latex asks us to rerun + let auxlinesAfter = Tex_GetAuxFile(auxFileName) + if auxlinesAfter != auxlinesBefore + echomsg "Need to rerun because the AUX file changed..." + call Tex_Debug("Tex_CompileMultipleTimes: Need to rerun to get cross-references right...", 'comp') + let needToRerun = 1 + endif + + let runCount = runCount + 1 + endwhile + + redraw! + call Tex_Debug("Tex_CompileMultipleTimes: Ran latex ".runCount." time(s)", "comp") + echomsg "Ran latex ".runCount." time(s)" + + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + " After all compiler calls are done, reparse the .log file for + " errors/warnings to handle the situation where the clist might have been + " emptied because of bibtex/makeindex being run as the last step. + exec 'silent! cfile '.mainFileName_root.'.log' + + exe 'cd '.s:origdir +endfunction " }}} +" Tex_GetAuxFile: get the contents of the AUX file {{{ +" Description: get the contents of the AUX file recursively including any +" @\input'ted AUX files. +function! Tex_GetAuxFile(auxFile) + if !filereadable(a:auxFile) + return '' + endif + + let auxContents = Tex_CatFile(a:auxFile) + let pattern = '@\input{\(.\{-}\)}' + + let auxContents = substitute(auxContents, pattern, '\=Tex_GetAuxFile(submatch(1))', 'g') + + return auxContents +endfunction " }}} + +" ============================================================================== +" Helper functions for +" . viewing the log file in preview mode. +" . syncing the display between the quickfix window and preview window +" . going to the correct line _and column_ number from from the quick fix +" window. +" ============================================================================== +" Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{ +" Description: +function! Tex_SetupErrorWindow() + let mainfname = Tex_GetMainFileName() + + let winnum = winnr() + + " close the quickfix window before trying to open it again, otherwise + " whether or not we end up in the quickfix window after the :cwindow + " command is not fixed. + cclose + cwindow + " create log file name from mainfname + let mfnlog = fnamemodify(mainfname, ":t:r").'.log' + call Tex_Debug('Tex_SetupErrorWindow: mfnlog = '.mfnlog, 'comp') + " if we moved to a different window, then it means we had some errors. + if winnum != winnr() + if Tex_GetVarValue('Tex_ShowErrorContext') + call Tex_UpdatePreviewWindow(mfnlog) + exe 'nnoremap <buffer> <silent> j j:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> k k:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> <up> <up>:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + exe 'nnoremap <buffer> <silent> <down> <down>:call Tex_UpdatePreviewWindow("'.mfnlog.'")<CR>' + endif + exe 'nnoremap <buffer> <silent> <enter> :call Tex_GotoErrorLocation("'.mfnlog.'")<CR>' + + setlocal nowrap + + " resize the window to just fit in with the number of lines. + exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' + if Tex_GetVarValue('Tex_GotoError') == 1 + call Tex_GotoErrorLocation(mfnlog) + else + exec s:origwinnum.' wincmd w' + endif + endif + +endfunction " }}} +" Tex_PositionPreviewWindow: positions the preview window correctly. {{{ +" Description: +" The purpose of this function is to count the number of times an error +" occurs on the same line. or in other words, if the current line is +" something like |10 error|, then we want to count the number of +" lines in the quickfix window before this line which also contain lines +" like |10 error|. +" +function! Tex_PositionPreviewWindow(filename) + + if getline('.') !~ '|\d\+ \(error\|warning\)|' + if !search('|\d\+ \(error\|warning\)|') + call Tex_Debug("not finding error pattern anywhere in quickfix window :".bufname(bufnr('%')), + \ 'comp') + pclose! + return + endif + endif + + " extract the error pattern (something like 'file.tex|10 error|') on the + " current line. + let errpat = matchstr(getline('.'), '^\f*|\d\+ \(error\|warning\)|\ze') + let errfile = matchstr(getline('.'), '^\f*\ze|\d\+ \(error\|warning\)|') + " extract the line number from the error pattern. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') + + " if we are on an error, then count the number of lines before this in the + " quickfix window with an error on the same line. + if errpat =~ 'error|$' + " our location in the quick fix window. + let errline = line('.') + + " goto the beginning of the quickfix window and begin counting the lines + " which show an error on the same line. + 0 + let numrep = 0 + while 1 + " if we are on the same kind of error line, then means we have another + " line containing the same error pattern. + if getline('.') =~ errpat + let numrep = numrep + 1 + normal! 0 + endif + " if we have reached the original location in the quick fix window, + " then break. + if line('.') == errline + break + else + " otherwise, search for the next line which contains the same + " error pattern again. goto the end of the current line so we + " dont count this line again. + normal! $ + call search(errpat, 'W') + endif + endwhile + else + let numrep = 1 + endif + + if getline('.') =~ '|\d\+ warning|' + let searchpat = escape(matchstr(getline('.'), '|\d\+ warning|\s*\zs.*'), '\ ') + else + let searchpat = 'l\.'.linenum + endif + + " We first need to be in the scope of the correct file in the .log file. + " This is important for example, when a.tex and b.tex both have errors on + " line 9 of the file and we want to go to the error of b.tex. Merely + " searching forward from the beginning of the log file for l.9 will always + " land us on the error in a.tex. + if errfile != '' + exec 'silent! bot pedit +/(\\(\\f\\|\\[\\|\]\\|\\s\\)*'.errfile.'/ '.a:filename + else + exec 'bot pedit +0 '.a:filename + endif + " Goto the preview window + " TODO: This is not robust enough. Check that a wincmd j actually takes + " us to the preview window. + wincmd j + " now search forward from this position in the preview window for the + " numrep^th error of the current line in the quickfix window. + while numrep > 0 + call search(searchpat, 'W') + let numrep = numrep - 1 + endwhile + normal! z. + +endfunction " }}} +" Tex_UpdatePreviewWindow: updates the view of the log file {{{ +" Description: +" This function should be called when focus is in a quickfix window. +" It opens the log file in a preview window and makes it display that +" part of the log file which corresponds to the error which the user is +" currently on in the quickfix window. Control returns to the quickfix +" window when the function returns. +" +function! Tex_UpdatePreviewWindow(filename) + call Tex_PositionPreviewWindow(a:filename) + + if &previewwindow + 6 wincmd _ + wincmd p + endif +endfunction " }}} +" Tex_GotoErrorLocation: goes to the correct location of error in the tex file {{{ +" Description: +" This function should be called when focus is in a quickfix window. This +" function will first open the preview window of the log file (if it is not +" already open), position the display of the preview to coincide with the +" current error under the cursor and then take the user to the file in +" which this error has occured. +" +" The position is both the correct line number and the column number. +function! Tex_GotoErrorLocation(filename) + + " first use vim's functionality to take us to the location of the error + " accurate to the line (not column). This lets us go to the correct file + " without applying any logic. + exec "normal! \<enter>" + " If the log file is not found, then going to the correct line number is + " all we can do. + if glob(a:filename) == '' + return + endif + + let winnum = winnr() + " then come back to the quickfix window + wincmd w + + " find out where in the file we had the error. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') + call Tex_PositionPreviewWindow(a:filename) + + if getline('.') =~ 'l.\d\+' + + let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') + " If the line is of the form + " l.10 ...and then there was some error + " it means (most probably) that only part of the erroneous line is + " shown. In this case, finding the length of the broken line is not + " correct. Instead goto the beginning of the line and search forward + " for the part which is displayed and then go to its end. + if brokenline =~ '^\M...' + let partline = matchstr(brokenline, '^\M...\m\zs.*') + let normcmd = "0/\\V".escape(partline, "\\")."/e+1\<CR>" + else + let column = strlen(brokenline) + 1 + let normcmd = column.'|' + endif + + elseif getline('.') =~ 'LaTeX Warning: \(Citation\|Reference\) `.*' + + let ref = matchstr(getline('.'), "LaTeX Warning: \\(Citation\\|Reference\\) `\\zs[^']\\+\\ze'") + let normcmd = '0/'.ref."\<CR>" + + else + + let normcmd = '0' + + endif + + " go back to the window where we came from. + exec winnum.' wincmd w' + exec 'silent! '.linenum.' | normal! '.normcmd + + if !Tex_GetVarValue('Tex_ShowErrorContext') + pclose! + endif +endfunction " }}} +" Tex_SetCompilerMaps: sets maps for compiling/viewing/searching {{{ +" Description: +function! <SID>Tex_SetCompilerMaps() + if exists('b:Tex_doneCompilerMaps') + return + endif + let s:ml = '<Leader>' + + nnoremap <buffer> <Plug>Tex_Compile :call Tex_RunLaTeX()<cr> + vnoremap <buffer> <Plug>Tex_Compile :call Tex_PartCompile()<cr> + nnoremap <buffer> <Plug>Tex_View :call Tex_ViewLaTeX()<cr> + nnoremap <buffer> <Plug>Tex_ForwardSearch :call Tex_ForwardSearchLaTeX()<cr> + + call Tex_MakeMap(s:ml."ll", "<Plug>Tex_Compile", 'n', '<buffer>') + call Tex_MakeMap(s:ml."ll", "<Plug>Tex_Compile", 'v', '<buffer>') + call Tex_MakeMap(s:ml."lv", "<Plug>Tex_View", 'n', '<buffer>') + call Tex_MakeMap(s:ml."ls", "<Plug>Tex_ForwardSearch", 'n', '<buffer>') +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') | + \ call <SID>Tex_SetCompilerMaps() +augroup END + +command! -nargs=0 -range=% TPartCompile :<line1>, <line2> silent! call Tex_PartCompile() +" Setting b:fragmentFile = 1 makes Tex_CompileLatex consider the present file +" the _main_ file irrespective of the presence of a .latexmain file. +command! -nargs=0 TCompileThis let b:fragmentFile = 1 +command! -nargs=0 TCompileMainFile let b:fragmentFile = 0 + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/custommacros.vim b/vim-latex/ftplugin/latex-suite/custommacros.vim new file mode 100644 index 0000000..a8482ab --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/custommacros.vim @@ -0,0 +1,255 @@ +"============================================================================= +" File: custommacros.vim +" Author: Mikolaj Machowski +" Version: 1.0 +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions for processing custom macros in the +" latex-suite/macros directory +"============================================================================= + +let s:path = expand('<sfile>:p:h') + +" Set path to macros dir dependent on OS {{{ +if has("unix") || has("macunix") + let s:macrodirpath = $HOME."/.vim/ftplugin/latex-suite/macros/" +elseif has("win32") + if exists("$HOME") + let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/" + else + let s:macrodirpath = $VIM."/vimfiles/ftplugin/latex-suite/macros/" + endif +endif + +" }}} +" SetCustomMacrosMenu: sets up the menu for Macros {{{ +function! <SID>SetCustomMacrosMenu() + let flist = Tex_FindInRtp('', 'macros') + exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call <SID>NewMacro("FFFromMMMenu")<CR>' + exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()<CR>' + + let i = 1 + while 1 + let fname = Tex_Strntok(flist, ',', i) + if fname == '' + break + endif + exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":<tab>".fname." :call <SID>DeleteMacro('".fname."')<CR>" + exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":<tab>".fname." :call <SID>EditMacro('".fname."')<CR>" + exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." <C-r>=<SID>ReadMacro('".fname."')<CR>" + exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":<tab>".fname." i<C-r>=<SID>ReadMacro('".fname."')<CR>" + let i = i + 1 + endwhile +endfunction + +if g:Tex_Menus + call <SID>SetCustomMacrosMenu() +endif + +" }}} +" NewMacro: opens new file in macros directory {{{ +function! <SID>NewMacro(...) + " Allow for calling :TMacroNew without argument or from menu and prompt + " for name. + if a:0 > 0 + let newmacroname = a:1 + else + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + + if newmacroname == "FFFromMMMenu" + " Check if NewMacro was called from menu and prompt for insert macro + " name + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + elseif Tex_FindInRtp(newmacroname, 'macros') != '' + " If macro with this name already exists, prompt for another name. + exe "echomsg 'Macro ".newmacroname." already exists. Try another name.'" + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.newmacroname) + setlocal filetype=tex +endfunction + +" }}} +" RedrawMacro: refreshes macro menu {{{ +function! RedrawMacro() + aunmenu TeX-Suite.Macros + call <SID>SetCustomMacrosMenu() +endfunction + +" }}} +" ChooseMacro: choose a macro file {{{ +" " Description: +function! s:ChooseMacro(ask) + let filelist = Tex_FindInRtp('', 'macros') + let filename = Tex_ChooseFromPrompt( + \ a:ask."\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or filename :", + \ filelist, ',') +endfunction + +" }}} +" DeleteMacro: deletes macro file {{{ +function! <SID>DeleteMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for deletion :') + endif + + if !filereadable(s:macrodirpath.filename) + " When file is not in local directory decline to remove it. + call confirm('This file is not in your local directory: '.filename."\n". + \ 'It will not be deleted.' , '&OK', 1) + + else + let ch = confirm('Really delete '.filename.' ?', "&Yes\n&No", 2) + if ch == 1 + call delete(s:macrodirpath.filename) + endif + call RedrawMacro() + endif +endfunction + +" }}} +" EditMacro: edits macro file {{{ +function! <SID>EditMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for insertion:') + endif + + if filereadable(s:macrodirpath.filename) + " If file exists in local directory open it. + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename) + else + " But if file doesn't exist in local dir it probably is in user + " restricted area. Instead opening try to copy it to local dir. + " Pity VimL doesn't have mkdir() function :) + let ch = confirm("You are trying to edit file which is probably read-only.\n". + \ "It will be copied to your local LaTeX-Suite macros directory\n". + \ "and you will be operating on local copy with suffix -local.\n". + \ "It will succeed only if ftplugin/latex-suite/macros dir exists.\n". + \ "Do you agree?", "&Yes\n&No", 1) + if ch == 1 + " But there is possibility we already created local modification. + " Check it and offer opening this file. + if filereadable(s:macrodirpath.filename.'-local') + let ch = confirm('Local version of '.filename." already exists.\n". + \ 'Do you want to open it or overwrite with original version?', + \ "&Open\nOver&write\n&Cancel", 1) + if ch == 1 + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename.'-local') + elseif ch == 2 + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + " This is possible macro was edited before, wipe it out. + if bufexists(s:macrodirpath.filename.'-local') + exe 'bwipe '.s:macrodirpath.filename.'-local' + endif + exe 'write! '.s:macrodirpath.filename.'-local' + else + return + endif + else + " If file doesn't exist, open new file, read in system macro and + " save it in local macro dir with suffix -local + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + exe 'write '.s:macrodirpath.filename.'-local' + endif + endif + + endif + setlocal filetype=tex +endfunction + +" }}} +" ReadMacro: reads in a macro from a macro file. {{{ +" allowing for placement via placeholders. +function! <SID>ReadMacro(...) + + if a:0 > 0 + let filename = a:1 + else + let filelist = Tex_FindInRtp('', 'macros') + let filename = + \ Tex_ChooseFromPrompt("Choose a macro file:\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or name of file :", + \ filelist, ',') + endif + + let fname = Tex_FindInRtp(filename, 'macros', ':p') + + let markerString = '<---- Latex Suite End Macro ---->' + let _a = @a + silent! call append(line('.'), markerString) + silent! exec "read ".fname + silent! exec "normal! V/^".markerString."$/-1\<CR>\"ax" + " This is kind of tricky: At this stage, we are one line after the one we + " started from with the marker text on it. We need to + " 1. remove the marker and the line. + " 2. get focus to the previous line. + " 3. not remove anything from the previous line. + silent! exec "normal! $v0k$\"_x" + + call Tex_CleanSearchHistory() + + let @a = substitute(@a, '['."\n\r\t ".']*$', '', '') + let textWithMovement = IMAP_PutTextWithMovement(@a) + let @a = _a + + return textWithMovement + +endfunction + +" }}} +" commands for macros {{{ +com! -nargs=? TMacroNew :call <SID>NewMacro(<f-args>) + +" This macros had to have 2 versions: +if v:version >= 602 + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacro + \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroEdit + \ :call <SID>EditMacro(<f-args>) + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroDelete + \ :call <SID>DeleteMacro(<f-args>) + + " Tex_CompleteMacroName: for completing names in TMacro... commands {{{ + " Description: get list of macro names with Tex_FindInRtp(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompleteMacroName(A,P,L) + " Get name of macros from all runtimepath directories + let macronames = Tex_FindInRtp('', 'macros') + " Separate names with \n not , + let macronames = substitute(macronames,',','\n','g') + return macronames + endfunction + + " }}} + +else + com! -nargs=? TMacro + \ :let s:retVal = <SID>ReadMacro(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + com! -nargs=? TMacroEdit :call <SID>EditMacro(<f-args>) + com! -nargs=? TMacroDelete :call <SID>DeleteMacro(<f-args>) + +endif + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/diacritics.vim b/vim-latex/ftplugin/latex-suite/diacritics.vim new file mode 100644 index 0000000..616d30a --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/diacritics.vim @@ -0,0 +1,124 @@ +"============================================================================= +" File: diacritics.vim +" Author: Lubomir Host +" Created: Tue Apr 23 07:00 PM 2002 PST +" +" Description: shortcuts for all diacritics. +"============================================================================= + +if !g:Tex_Diacritics + finish +endif + +" \'{a} {{{ +call IMAP ('=a', "\\\'{a}", 'tex') +call IMAP ('=b', "\\'{b}", 'tex') +call IMAP ('=c', "\\'{c}", 'tex') +call IMAP ('=d', "\\'{d}", 'tex') +call IMAP ('=e', "\\'{e}", 'tex') +call IMAP ('=f', "\\'{f}", 'tex') +call IMAP ('=g', "\\'{g}", 'tex') +call IMAP ('=h', "\\'{h}", 'tex') +call IMAP ('=i', "\\'{\i}", 'tex') +call IMAP ('=j', "\\'{j}", 'tex') +call IMAP ('=k', "\\'{k}", 'tex') +call IMAP ('=l', "\\'{l}", 'tex') +call IMAP ('=m', "\\'{m}", 'tex') +call IMAP ('=n', "\\'{n}", 'tex') +call IMAP ('=o', "\\'{o}", 'tex') +call IMAP ('=p', "\\'{p}", 'tex') +call IMAP ('=q', "\\'{q}", 'tex') +call IMAP ('=r', "\\'{r}", 'tex') +call IMAP ('=s', "\\'{s}", 'tex') +call IMAP ('=t', "\\'{t}", 'tex') +call IMAP ('=u', "\\'{u}", 'tex') +call IMAP ('=v', "\\'{v}", 'tex') +call IMAP ('=w', "\\'{w}", 'tex') +call IMAP ('=x', "\\'{x}", 'tex') +call IMAP ('=y', "\\'{y}", 'tex') +call IMAP ('=z', "\\'{z}", 'tex') +call IMAP ('=A', "\\'{A}", 'tex') +call IMAP ('=B', "\\'{B}", 'tex') +call IMAP ('=C', "\\'{C}", 'tex') +call IMAP ('=D', "\\'{D}", 'tex') +call IMAP ('=E', "\\'{E}", 'tex') +call IMAP ('=F', "\\'{F}", 'tex') +call IMAP ('=G', "\\'{G}", 'tex') +call IMAP ('=H', "\\'{H}", 'tex') +call IMAP ('=I', "\\'{\I}", 'tex') +call IMAP ('=J', "\\'{J}", 'tex') +call IMAP ('=K', "\\'{K}", 'tex') +call IMAP ('=L', "\\'{L}", 'tex') +call IMAP ('=M', "\\'{M}", 'tex') +call IMAP ('=N', "\\'{N}", 'tex') +call IMAP ('=O', "\\'{O}", 'tex') +call IMAP ('=P', "\\'{P}", 'tex') +call IMAP ('=Q', "\\'{Q}", 'tex') +call IMAP ('=R', "\\'{R}", 'tex') +call IMAP ('=S', "\\'{S}", 'tex') +call IMAP ('=T', "\\'{T}", 'tex') +call IMAP ('=U', "\\'{U}", 'tex') +call IMAP ('=V', "\\'{V}", 'tex') +call IMAP ('=W', "\\'{W}", 'tex') +call IMAP ('=X', "\\'{X}", 'tex') +call IMAP ('=Y', "\\'{Y}", 'tex') +call IMAP ('=Z', "\\'{Z}", 'tex') +" }}} +" \v{a} {{{ +call IMAP ('+a', "\\v{a}", 'tex') +call IMAP ('+b', "\\v{b}", 'tex') +call IMAP ('+c', "\\v{c}", 'tex') +call IMAP ('+d', "\\v{d}", 'tex') +call IMAP ('+e', "\\v{e}", 'tex') +call IMAP ('+f', "\\v{f}", 'tex') +call IMAP ('+g', "\\v{g}", 'tex') +call IMAP ('+h', "\\v{h}", 'tex') +call IMAP ('+i', "\\v{\i}", 'tex') +call IMAP ('+j', "\\v{j}", 'tex') +call IMAP ('+k', "\\v{k}", 'tex') +call IMAP ('+l', "\\q l", 'tex') +call IMAP ('+m', "\\v{m}", 'tex') +call IMAP ('+n', "\\v{n}", 'tex') +call IMAP ('+o', "\\v{o}", 'tex') +call IMAP ('+p', "\\v{p}", 'tex') +call IMAP ('+q', "\\v{q}", 'tex') +call IMAP ('+r', "\\v{r}", 'tex') +call IMAP ('+s', "\\v{s}", 'tex') +call IMAP ('+t', "\\q t", 'tex') +call IMAP ('+u', "\\v{u}", 'tex') +call IMAP ('+v', "\\v{v}", 'tex') +call IMAP ('+w', "\\v{w}", 'tex') +call IMAP ('+x', "\\v{x}", 'tex') +call IMAP ('+y', "\\v{y}", 'tex') +call IMAP ('+z', "\\v{z}", 'tex') +call IMAP ('+A', "\\v{A}", 'tex') +call IMAP ('+B', "\\v{B}", 'tex') +call IMAP ('+C', "\\v{C}", 'tex') +call IMAP ('+D', "\\v{D}", 'tex') +call IMAP ('+E', "\\v{E}", 'tex') +call IMAP ('+F', "\\v{F}", 'tex') +call IMAP ('+G', "\\v{G}", 'tex') +call IMAP ('+H', "\\v{H}", 'tex') +call IMAP ('+I', "\\v{\I}", 'tex') +call IMAP ('+J', "\\v{J}", 'tex') +call IMAP ('+K', "\\v{K}", 'tex') +call IMAP ('+L', "\\v{L}", 'tex') +call IMAP ('+M', "\\v{M}", 'tex') +call IMAP ('+N', "\\v{N}", 'tex') +call IMAP ('+O', "\\v{O}", 'tex') +call IMAP ('+P', "\\v{P}", 'tex') +call IMAP ('+Q', "\\v{Q}", 'tex') +call IMAP ('+R', "\\v{R}", 'tex') +call IMAP ('+S', "\\v{S}", 'tex') +call IMAP ('+T', "\\v{T}", 'tex') +call IMAP ('+U', "\\v{U}", 'tex') +call IMAP ('+V', "\\v{V}", 'tex') +call IMAP ('+W', "\\v{W}", 'tex') +call IMAP ('+X', "\\v{X}", 'tex') +call IMAP ('+Y', "\\v{Y}", 'tex') +call IMAP ('+Z', "\\v{Z}", 'tex') +" }}} +call IMAP ('+}', "\\\"{a}", 'tex') +call IMAP ('+:', "\\^{o}", 'tex') + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/dictionaries/SIunits b/vim-latex/ftplugin/latex-suite/dictionaries/SIunits new file mode 100644 index 0000000..d4ac081 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/dictionaries/SIunits @@ -0,0 +1,289 @@ +addprefix +addunit +ampere +amperemetresecond +amperepermetre +amperepermetrenp +amperepersquaremetre +amperepersquaremetrenp +angstrom +arad +arcminute +arcsecond +are +atomicmass +atto +attod +barn +bbar +becquerel +becquerelbase +bel +candela +candelapersquaremetre +candelapersquaremetrenp +celsius +Celsius +celsiusbase +centi +centid +coulomb +coulombbase +coulombpercubicmetre +coulombpercubicmetrenp +coulombperkilogram +coulombperkilogramnp +coulombpermol +coulombpermolnp +coulombpersquaremetre +coulombpersquaremetrenp +cubed +cubic +cubicmetre +cubicmetreperkilogram +cubicmetrepersecond +curie +dday +deca +decad +deci +decid +degree +degreecelsius +deka +dekad +derbecquerel +dercelsius +dercoulomb +derfarad +dergray +derhenry +derhertz +derjoule +derkatal +derlumen +derlux +dernewton +derohm +derpascal +derradian +dersiemens +dersievert +dersteradian +dertesla +dervolt +derwatt +derweber +electronvolt +exa +exad +farad +faradbase +faradpermetre +faradpermetrenp +femto +femtod +fourth +gal +giga +gigad +gram +graybase +graypersecond +graypersecondnp +hectare +hecto +hectod +henry +henrybase +henrypermetre +henrypermetrenp +hertz +hertzbase +hour +joule +joulebase +joulepercubicmetre +joulepercubicmetrenp +jouleperkelvin +jouleperkelvinnp +jouleperkilogram +jouleperkilogramkelvin +jouleperkilogramkelvinnp +jouleperkilogramnp +joulepermole +joulepermolekelvin +joulepermolekelvinnp +joulepermolenp +joulepersquaremetre +joulepersquaremetrenp +joulepertesla +jouleperteslanp +katal +katalbase +katalpercubicmetre +katalpercubicmetrenp +kelvin +kilo +kilod +kilogram +kilogrammetrepersecond +kilogrammetrepersecondnp +kilogrammetrepersquaresecond +kilogrammetrepersquaresecondnp +kilogrampercubicmetre +kilogrampercubicmetrecoulomb +kilogrampercubicmetrecoulombnp +kilogrampercubicmetrenp +kilogramperkilomole +kilogramperkilomolenp +kilogrampermetre +kilogrampermetrenp +kilogrampersecond +kilogrampersecondcubicmetre +kilogrampersecondcubicmetrenp +kilogrampersecondnp +kilogrampersquaremetre +kilogrampersquaremetrenp +kilogrampersquaremetresecond +kilogrampersquaremetresecondnp +kilogramsquaremetre +kilogramsquaremetrenp +kilogramsquaremetrepersecond +kilogramsquaremetrepersecondnp +kilowatthour +liter +litre +lumen +lumenbase +lux +luxbase +mega +megad +meter +metre +metrepersecond +metrepersecondnp +metrepersquaresecond +metrepersquaresecondnp +micro +microd +milli +millid +minute +mole +molepercubicmetre +molepercubicmetrenp +nano +nanod +neper +newton +newtonbase +newtonmetre +newtonpercubicmetre +newtonpercubicmetrenp +newtonperkilogram +newtonperkilogramnp +newtonpermetre +newtonpermetrenp +newtonpersquaremetre +newtonpersquaremetrenp +NoAMS +no@qsk +ohm +ohmbase +ohmmetre +one +paminute +pascal +pascalbase +pascalsecond +pasecond +per +period@active +persquaremetresecond +persquaremetresecondnp +peta +petad +pico +picod +power +@qsk +quantityskip +rad +radian +radianbase +radianpersecond +radianpersecondnp +radianpersquaresecond +radianpersquaresecondnp +reciprocal +rem +roentgen +rp +rpcubed +rpcubic +rpcubicmetreperkilogram +rpcubicmetrepersecond +rperminute +rpersecond +rpfourth +rpsquare +rpsquared +rpsquaremetreperkilogram +second +siemens +siemensbase +sievert +sievertbase +square +squared +squaremetre +squaremetrepercubicmetre +squaremetrepercubicmetrenp +squaremetrepercubicsecond +squaremetrepercubicsecondnp +squaremetreperkilogram +squaremetrepernewtonsecond +squaremetrepernewtonsecondnp +squaremetrepersecond +squaremetrepersecondnp +squaremetrepersquaresecond +squaremetrepersquaresecondnp +steradian +steradianbase +tera +terad +tesla +teslabase +ton +tonne +unit +unitskip +usk +volt +voltbase +voltpermetre +voltpermetrenp +watt +wattbase +wattpercubicmetre +wattpercubicmetrenp +wattperkilogram +wattperkilogramnp +wattpermetrekelvin +wattpermetrekelvinnp +wattpersquaremetre +wattpersquaremetrenp +wattpersquaremetresteradian +wattpersquaremetresteradiannp +weber +weberbase +yocto +yoctod +yotta +yottad +zepto +zeptod +zetta +zettad diff --git a/vim-latex/ftplugin/latex-suite/dictionaries/dictionary b/vim-latex/ftplugin/latex-suite/dictionaries/dictionary new file mode 100644 index 0000000..458dc0b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/dictionaries/dictionary @@ -0,0 +1,677 @@ +abbrv +abovedisplayshortskip +abovedisplayskip +abstract +abstract +abstractname +acute +addcontentsline +address +addtime +addtocontents +addtocounter +addtolength +addvspace +align +alph +Alph +alpha +amsmath +amsthm +and +appendix +appendixname +arabic +array +arraycolsep +arrayrulewidth +arraystretch +article +author +a4paper +a5paper +backmatter +bar +bar +baselineskip +baselinestretch +batchmode +begin +belowdisplayshortskip +belowdisplayskip +bezier +bf +bfseries +bibindent +bibitem +bibliography +bibliographystyle +bibname +big +Big +Bigg +bigg +Biggl +biggl +Biggm +biggm +Biggr +biggr +Bigl +bigl +bigm +Bigm +bigr +Bigr +bigskip +bigskipamount +binom +blg +boldmath +boldsymbol +book +botfigrule +bottmofraction +bottomnumber +boxedminipage +bp +breve +b5paper +calc +calc +caption +caption2 +capt-of +cases +cc +ccaption +ccname +cdotscenter +centering +cercle +cfrac +changebar +chapter +chapterbib +chaptername +check +cite +cleardoublepage +clearpage +cline +clock +closing +cm +COLON +columnsep +columnseprule +columnwidth +contentsline +contentsname +copyright +dag +dashbox +date +dbinom +dblfigure +dblfloatpage +dblfloatsep +dbltextfloatsep +dbltopfraction +dbltopnumber +dcolumn +dd +ddag +ddot +ddots +DeclareMathOperator +depth +description +dfrac +displaylimits +displaymath +displaystyle +document +documentclass +dot +dotfill +doublerulesep +downbracefill +draft +dropping +dywiz +em +emph +empty +encl +enclname +end +endfloat +enlargethispage +enskip +enspace +ensuremath +enumerate +enumi +enumii +enumiii +enumiv +eqnarray +equation +errorstopmode +eucal +eufrak +evensidemargin +everyship +ex +executivepaper +expdlist +extracolsep +extramark +fancybox +fancyhdr +fbox +fboxrule +fboxsep +figure +figurename +file +filecontents +final +flafter +fleqn +floatflt +floatpagefraction +floatsep +flushbottom +flushleft +flushright +fnpara +fnsymbol +fn2end +fontenc +footheight +footmisc +footnote +footnotemark +footnoterule +footnotesep +footnotesize +footnotetext +footnpag +footskip +frac +frame +framebox +frenchspacing +frontmatter +ftnright +fussy +gather +genfrac +geometry +glossary +glossaryentry +graphicx +graphpaper +grave +hat +hbox +headheihgt +headings +headsep +height +helvet +hfill +hhline +hline +hrulefill +hspace +huge +Huge +HUGE +hyperref +hyphenation +ifthen +in +include +includeonly +indent +indentfirst +index +indexentry +indexname +indexspace +input +inputenc +intertext +intextsep +invisible +it +item +itemindent +itemize +itemsep +itshape +jot +kill +label +labelenumi +labelenumii +labelenumiii +labelenumiv +labelitemi +labelitemii +labelitemiii +labelitemiv +labelsep +labelwidth +landscape +large +LARGE +Large +LaTeX +LaTeXe +latexsym +ldots +left +leftarrowfill +lefteqn +leftmargin +leftmargini +leftmarginii +leftmarginiii +leftmarginiv +leftmarginv +leftmarginvi +leftmark +legalpaper +leq +leqno +letter +letterpaper +letterspace +lhead +limits +line +linebreak +linethickness +linewidth +list +listfigurename +listfiles +listoffigures +listoftables +listparindent +location +longtable +lq +lrbox +lscape +mainmatter +makeatletter +makeatother +makebox +makeglossary +makeidx +makeindex +makelabel +maketitle +manyfoot +marginpar +marginparpush +marginparsep +marginparwidth +markboth +markleft +markright +math +mathbb +mathbf +mathbin +mathcal +mathclose +mathfrak +mathindent +mathit +mathnormal +mathop +mathopen +mathord +mathpunct +mathrel +mathrm +mathscr +mathsf +mathstrut +mathtt +mathversion +mbox +mdseries +medmuskip +medskip +medskipamount +minipage +minitoc +minus +mkern +mm +moreverbatim +mpfootnote +mu +multicol +multicolumn +multilanguage +multiput +multirow +myheadings +nabla +name +NeedsTeXFormat +newcommand +newcounter +newenvironment +newfont +newlength +newline +newpage +newsavebox +newtheorem +nocite +nofiles +noindent +nolimits +nolinebreak +nomathsymbols +nonfrenchspacing +nonumber +nopagebreak +normalfont +normalsize +not +notag +note +notitlepage +nu +numberline +numline +numprint +oddsidemargin +oldstyle +onecolumn +oneside +onlynotes +onlyslides +openany +openbib +opening +openright +operatorname +oval +overbrace +overlay +overleftarrow +overline +overrightarrow +page +pagebreak +pagenumbering +pageref +pagestyle +paperheight +paperwidth +par +paragraph +parbox +parbox +parindent +parsep +parskip +part +partial +partname +partopsep +pauza +pc +phi +pi +picture +plain +PLdateending +plmath +PLSlash +plus +pmb +pmod +polski +polski +poptabs +pounds +ppauza +prefixing +printindex +protect +providecommand +ps +pt +pushtabs +put +qbezier +qbeziermax +qquad +quad +quotation +quote +raggedbottom +raggedleft +raggedright +ragged2e +raisebox +ratio +real +ref +refname +refstepcounter +relsize +renewcommand +renewenvironment +report +reversemarginpar +rhead +right +rightarrowfill +rightmargin +rightmark +rm +rmfamily +roman +Roman +rotate +rotating +rq +rule +samepage +savebox +sb +sbox +sc +scriptscriptstyle +scriptsize +scriptstyle +scrollmode +scshape +secnumdepth +section +sectionmark +see +seename +selectfont +selectlanguage +setcounter +setlength +settime +settodepth +settoheight +settowidth +sf +sffamily +shadethm +shadow +shapepar +shortstack +showlabels +sidecap +signature +sin +sl +slide +slides +sloppy +sloppybar +slshape +small +smallskip +smallskipamount +soul +sp +space +sqrt +ss +SS +stackrel +startbreaks +stepcounter +stop +stopbreaks +stretch +strut +subfigure +subfigure +subitem +subparagraph +subsection +subsubitem +subsubsection +sum +supressfloats +symbol +symbol +tabbing +tabcolsep +table +tablename +tableofcontents +tabular +tabularx +tag +tan +tbinom +telephone +TeX +textbf +textbullet +textcircled +textcompwordmark +textemdash +textendash +textexclamdown +textfloatsep +textfraction +textheight +textit +textmd +textnormal +textperiodcenter +textquestiondown +textquotedblleft +textquotedblright +textquoteleft +textquoteright +textrm +textsc +textsf +textsl +textstyle +textsuperscript +texttt +textup +textvisiblespace +textwidth +tfrac +thanks +the +thebibliography +theindex +theorem +thepage +thesection +theta +thicklines +thickmuskip +thinlines +thispagestyle +tilde +time +times +tiny +title +titlepage +tocdepth +today +topfigrule +topfraction +topmargin +topmargin +topmargin +topsep +topskip +topskip +totalheight +totalnumber +trivlist +tt +ttfamily +twocolumn +twocolumn +twoside +typein +typein +typeout +typeout +ulem +ulem +unboldmath +underbrace +underline +unsort +unsrt +upbracefill +upshape +upshape +usebox +usebox +usecounter +usefont +usepackage +value +vbox +vdots +vec +vector +verb +verb +verbatim +verse +vfill +visible +vline +vmargin +voffset +vspace +widehat +widetilde +width +wrapfig +xleftarrow +xrightarrow +threeparttable diff --git a/vim-latex/ftplugin/latex-suite/elementmacros.vim b/vim-latex/ftplugin/latex-suite/elementmacros.vim new file mode 100644 index 0000000..132291a --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/elementmacros.vim @@ -0,0 +1,330 @@ +"============================================================================= +" File: elementmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for dimensions/fonts/counters. +" and various common commands such ref/label/footnote. +"============================================================================= + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +if exists('s:lastElementsLocation') && g:Tex_ElementsMenuLocation == s:lastElementsLocation + finish +endif + +if exists('s:lastElementsLocation') + exe 'aunmenu '.s:lastElementsLocation.'Font.' + exe 'aunmenu '.s:lastElementsLocation.'Dimension.' + exe 'aunmenu '.s:lastElementsLocation.'Counters.' + exe 'aunmenu '.s:lastElementsLocation.'Various.' +endif + +let s:lastElementsLocation = g:Tex_ElementsMenuLocation + +let s:fontMenuLoc = g:Tex_ElementsMenuLocation.'Font.' +let s:dimensionMenuLoc = g:Tex_ElementsMenuLocation.'Dimension.' +let s:counterMenuLoc = g:Tex_ElementsMenuLocation.'Counters.' +let s:variousMenuLoc = g:Tex_ElementsMenuLocation.'Various.' + +" ============================================================================== +" Set up the functions the first time. +" ============================================================================== +if !exists('s:definedFuncs') " {{{ + let s:definedFuncs = 1 + + " Tex_RemoveElementMenus: remove the elements menu {{{ + function! Tex_RemoveElementMenus() + exe 'silent! aunmenu '.s:lastElementsLocation.'Font.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Dimension.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Counters.' + exe 'silent! aunmenu '.s:lastElementsLocation.'Various.' + endfunction " }}} + " Tex_FontFamily: sets up font menus {{{ + function! <SID>Tex_FontFamily(font,fam) + let vislhs = matchstr(tolower(a:font), '^.\zs.*') + + " avoid redoing imaps and vmaps for every reconfiguration of menus. + if !exists('s:doneOnce') && g:Tex_FontMaps + exe "vnoremap <silent> ".g:Tex_Leader.vislhs. + \" \<C-\\>\<C-N>:call VEnclose('\\text".vislhs."{', '}', '{\\".vislhs.a:fam." ', '}')<CR>" + exe 'call IMAP ("'.a:font.'", "\\text'.vislhs.'{<++>}<++>", "tex")' + endif + + " menu entry. + if g:Tex_Menus && g:Tex_FontMenus + let location = s:fontMenuLoc.substitute(a:fam, '^.', '\u&', '').'.'.vislhs.a:fam.'<tab>'.a:font.'\ ('.g:Tex_Leader.vislhs.')' + exe "amenu ".location. + \" <plug><C-r>=IMAP_PutTextWithMovement('\\text".vislhs."{<++>}<++>')<CR>" + exe "vmenu ".location. + \" \<C-\\>\<C-N>:call VEnclose('\\text".vislhs."{', '}', '{\\".vislhs.a:fam." ', '}')<CR>" + endif + + endfunction " }}} + " Tex_FontDiacritics: sets up menus for diacritics. {{{ + function! <SID>Tex_FontDiacritics(name, rhs) + let location = s:fontMenuLoc.'&Diacritics.'.a:name.'<tab>' + exe 'amenu '.location. + \" <plug><C-r>=IMAP_PutTextWithMovement('\\".a:rhs."{<++>}<++>')<CR>" + exe 'vmenu '.location. + \" \<C-\\>\<C-n>:call VEnclose('\\".a:rhs."{', '}', '', '')<CR>" + endfunction " }}} + " Tex_FontSize: sets up size fonts {{{ + function! <SID>Tex_FontSize(name) + let location = s:fontMenuLoc.'&Size.'.a:name.'<tab>' + exe 'amenu '.location." <plug>\\".a:name + exe 'vunmenu '.location + endfunction " }}} + " Tex_Fontfont: sets up the 'font' part of font menus {{{ + function! <SID>Tex_Fontfont(desc, lhs) + let location = s:fontMenuLoc.'&font.'.a:desc.'<tab>' + exe "amenu ".location." <plug><C-r>=IMAP_PutTextWithMovement('".a:lhs."')<CR>" + exe "vunmenu ".location + endfunction " }}} + " Tex_DimMenus: set up dimension menus {{{ + function! <SID>Tex_DimMenus(submenu, rhs) + let location = s:dimensionMenuLoc.a:submenu.'.'.a:rhs.'<tab>' + exe "amenu ".location." <plug>\\".a:rhs + exe "vunmenu ".location + endfunction " }}} + " Tex_CounterMenus: set up counters menus {{{ + function! <SID>Tex_CounterMenus(submenu, rhs) + let location = s:counterMenuLoc.a:submenu.'.'.a:rhs.'<tab>' + exe "amenu ".location." <plug>\\".a:rhs + exe "vunmenu ".location + endfunction " }}} + " Tex_VariousMenus: set up various menus {{{ + function! <SID>Tex_VariousMenus(desc, lhs) + let location = s:variousMenuLoc.a:desc.'<tab>' + exe "amenu ".location." <plug><C-r>=IMAP_PutTextWithMovement('".a:lhs."')<CR>" + exe "vunmenu ".location + endfunction " }}} + +endif +" }}} + +" ============================================================================== +" Fonts +" ============================================================================== +" series/family/shape {{{ +call <SID>Tex_FontFamily("FBF","series") +call <SID>Tex_FontFamily("FMD","series") + +call <SID>Tex_FontFamily("FTT","family") +call <SID>Tex_FontFamily("FSF","family") +call <SID>Tex_FontFamily("FRM","family") + +call <SID>Tex_FontFamily("FUP","shape") +call <SID>Tex_FontFamily("FSL","shape") +call <SID>Tex_FontFamily("FSC","shape") +call <SID>Tex_FontFamily("FIT","shape") + +" the \emph is special. +if g:Tex_FontMaps | exe "vnoremap <silent> ".g:Tex_Leader."em \<C-\\>\<C-N>:call VEnclose('\\emph{', '}', '{\\em', '\\/}')<CR>" | endif +if g:Tex_FontMaps | exe 'call IMAP ("FEM", "\\emph{<++>}<++>", "tex")' | endif + +" }}} +if g:Tex_Menus && g:Tex_FontMenus + " {{{ diacritics + call <SID>Tex_FontDiacritics('Acute', '"') + call <SID>Tex_FontDiacritics('Breve', 'u') + call <SID>Tex_FontDiacritics('Circle', 'r') + call <SID>Tex_FontDiacritics('Circumflex', '^') + call <SID>Tex_FontDiacritics('Umlaut', '"') + call <SID>Tex_FontDiacritics('HUmlaut', 'H') + call <SID>Tex_FontDiacritics('Dot\ over', '.') + call <SID>Tex_FontDiacritics('Grave', '`') + call <SID>Tex_FontDiacritics('Hacek', 'v') + call <SID>Tex_FontDiacritics('Makron', '=') + call <SID>Tex_FontDiacritics('Tilde', '~') + call <SID>Tex_FontDiacritics('Underline', 'b') + call <SID>Tex_FontDiacritics('Cedille', 'c') + call <SID>Tex_FontDiacritics('Dot\ under', ' ') + call <SID>Tex_FontDiacritics('Ligature', 't') + " }}} + " {{{ Si&ze. + call <SID>Tex_FontSize('tiny') + call <SID>Tex_FontSize('scriptsize') + call <SID>Tex_FontSize('footnotesize') + call <SID>Tex_FontSize('small') + call <SID>Tex_FontSize('normalsize') + call <SID>Tex_FontSize('large') + call <SID>Tex_FontSize('Large') + call <SID>Tex_FontSize('LARGE') + call <SID>Tex_FontSize('huge') + call <SID>Tex_FontSize('Huge') + " }}} + " {{{ &font. + call s:Tex_Fontfont('fontencoding{}', '\fontencoding{<++>}<++>') + call s:Tex_Fontfont('fontfamily{qtm}', '\fontfamily{<++>}<++>') + call s:Tex_Fontfont('fontseries{m\ b\ bx\ sb\ c}', '\fontseries{<++>}<++>') + call s:Tex_Fontfont('fontshape{n\ it\ sl\ sc\ ui}', '\fontshape{<++>}<++>') + call s:Tex_Fontfont('fontsize{}{}', '\fontsize{<++>}{<++>}<++>') + call s:Tex_Fontfont('selectfont', '\selectfont ') + " }}} +endif + +" ============================================================================== +" Dimensions +" ============================================================================== +if g:Tex_Menus + " {{{ Static1 + call <SID>Tex_DimMenus('Static1', 'arraycolsep') + call <SID>Tex_DimMenus('Static1', 'arrayrulewidth') + call <SID>Tex_DimMenus('Static1', 'bibindent') + call <SID>Tex_DimMenus('Static1', 'columnsep') + call <SID>Tex_DimMenus('Static1', 'columnseprule') + call <SID>Tex_DimMenus('Static1', 'columnwidth') + call <SID>Tex_DimMenus('Static1', 'doublerulesep') + call <SID>Tex_DimMenus('Static1', 'evensidemargin') + call <SID>Tex_DimMenus('Static1', 'fboxrule') + call <SID>Tex_DimMenus('Static1', 'fboxsep') + call <SID>Tex_DimMenus('Static1', 'footheight') + call <SID>Tex_DimMenus('Static1', 'footnotesep') + call <SID>Tex_DimMenus('Static1', 'footskip') + call <SID>Tex_DimMenus('Static1', 'headheight') + call <SID>Tex_DimMenus('Static1', 'headsep') + call <SID>Tex_DimMenus('Static1', 'itemindent') + call <SID>Tex_DimMenus('Static1', 'labelsep') + call <SID>Tex_DimMenus('Static1', 'labelwidth') + call <SID>Tex_DimMenus('Static1', 'leftmargin') + call <SID>Tex_DimMenus('Static1', 'leftmargini') + call <SID>Tex_DimMenus('Static1', 'leftmarginii') + call <SID>Tex_DimMenus('Static1', 'leftmarginiii') + call <SID>Tex_DimMenus('Static1', 'leftmarginiv') + call <SID>Tex_DimMenus('Static1', 'leftmarginv') + call <SID>Tex_DimMenus('Static1', 'leftmarginvi') + call <SID>Tex_DimMenus('Static1', 'linewidth') + call <SID>Tex_DimMenus('Static1', 'listparindent') + call <SID>Tex_DimMenus('Static1', 'marginparpush') + call <SID>Tex_DimMenus('Static1', 'marginparsep') + call <SID>Tex_DimMenus('Static1', 'marginparwidth') + call <SID>Tex_DimMenus('Static1', 'mathindent') + call <SID>Tex_DimMenus('Static1', 'oddsidemargin') + " }}} + " {{{ Static2 + call <SID>Tex_DimMenus('Static2', 'paperheight') + call <SID>Tex_DimMenus('Static2', 'paperwidth') + call <SID>Tex_DimMenus('Static2', 'parindent') + call <SID>Tex_DimMenus('Static2', 'rightmargin') + call <SID>Tex_DimMenus('Static2', 'tabbingsep') + call <SID>Tex_DimMenus('Static2', 'tabcolsep') + call <SID>Tex_DimMenus('Static2', 'textheight') + call <SID>Tex_DimMenus('Static2', 'textwidth') + call <SID>Tex_DimMenus('Static2', 'topmargin') + call <SID>Tex_DimMenus('Static2', 'unitlength') + " }}} + " {{{ Dynamic + call <SID>Tex_DimMenus('Dynamic', 'abovedisplayshortskip') + call <SID>Tex_DimMenus('Dynamic', 'abovedisplayskip') + call <SID>Tex_DimMenus('Dynamic', 'baselineskip') + call <SID>Tex_DimMenus('Dynamic', 'belowdisplayshortskip') + call <SID>Tex_DimMenus('Dynamic', 'belowdisplayskip') + call <SID>Tex_DimMenus('Dynamic', 'dblfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'dbltextfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'floatsep') + call <SID>Tex_DimMenus('Dynamic', 'intextsep') + call <SID>Tex_DimMenus('Dynamic', 'itemsep') + call <SID>Tex_DimMenus('Dynamic', 'parsep') + call <SID>Tex_DimMenus('Dynamic', 'parskip') + call <SID>Tex_DimMenus('Dynamic', 'partopsep') + call <SID>Tex_DimMenus('Dynamic', 'textfloatsep') + call <SID>Tex_DimMenus('Dynamic', 'topsep') + call <SID>Tex_DimMenus('Dynamic', 'topskip') + " }}} + " {{{ Change + call <SID>Tex_DimMenus('Change', 'setlength') + call <SID>Tex_DimMenus('Change', 'addtolength') + call <SID>Tex_DimMenus('Change', 'settoheight') + call <SID>Tex_DimMenus('Change', 'settowidth') + call <SID>Tex_DimMenus('Change', 'settolength') + " }}} +endif + +" ============================================================================== +" Counters +" ============================================================================== +if g:Tex_Menus + " Counters {{{ + call <SID>Tex_CounterMenus('Counters', 'bottomnumber') + call <SID>Tex_CounterMenus('Counters', 'chapter') + call <SID>Tex_CounterMenus('Counters', 'dbltopnumber') + call <SID>Tex_CounterMenus('Counters', 'enumi') + call <SID>Tex_CounterMenus('Counters', 'enumii') + call <SID>Tex_CounterMenus('Counters', 'enumiii') + call <SID>Tex_CounterMenus('Counters', 'enumiv') + call <SID>Tex_CounterMenus('Counters', 'equation') + call <SID>Tex_CounterMenus('Counters', 'figure') + call <SID>Tex_CounterMenus('Counters', 'footnote') + call <SID>Tex_CounterMenus('Counters', 'mpfootnote') + call <SID>Tex_CounterMenus('Counters', 'page') + call <SID>Tex_CounterMenus('Counters', 'paragraph') + call <SID>Tex_CounterMenus('Counters', 'part') + call <SID>Tex_CounterMenus('Counters', 'secnumdepth') + call <SID>Tex_CounterMenus('Counters', 'section') + call <SID>Tex_CounterMenus('Counters', 'subparagraph') + call <SID>Tex_CounterMenus('Counters', 'subsection') + call <SID>Tex_CounterMenus('Counters', 'subsubsection') + call <SID>Tex_CounterMenus('Counters', 'table') + call <SID>Tex_CounterMenus('Counters', 'tocdepth') + call <SID>Tex_CounterMenus('Counters', 'topnumber') + call <SID>Tex_CounterMenus('Counters', 'totalnumber') + " }}} + " theCounters {{{ + call <SID>Tex_CounterMenus('theCounters', 'thebottomnumber') + call <SID>Tex_CounterMenus('theCounters', 'thechapter') + call <SID>Tex_CounterMenus('theCounters', 'thedbltopnumber') + call <SID>Tex_CounterMenus('theCounters', 'theenumi') + call <SID>Tex_CounterMenus('theCounters', 'theenumii') + call <SID>Tex_CounterMenus('theCounters', 'theenumiii') + call <SID>Tex_CounterMenus('theCounters', 'theenumiv') + call <SID>Tex_CounterMenus('theCounters', 'theequation') + call <SID>Tex_CounterMenus('theCounters', 'thefigure') + call <SID>Tex_CounterMenus('theCounters', 'thefootnote') + call <SID>Tex_CounterMenus('theCounters', 'thempfootnote') + call <SID>Tex_CounterMenus('theCounters', 'thepage') + call <SID>Tex_CounterMenus('theCounters', 'theparagraph') + call <SID>Tex_CounterMenus('theCounters', 'thepart') + call <SID>Tex_CounterMenus('theCounters', 'thesecnumdepth') + call <SID>Tex_CounterMenus('theCounters', 'thesection') + call <SID>Tex_CounterMenus('theCounters', 'thesubparagraph') + call <SID>Tex_CounterMenus('theCounters', 'thesubsection') + call <SID>Tex_CounterMenus('theCounters', 'thesubsubsection') + call <SID>Tex_CounterMenus('theCounters', 'thetable') + call <SID>Tex_CounterMenus('theCounters', 'thetocdepth') + call <SID>Tex_CounterMenus('theCounters', 'thetopnumber') + call <SID>Tex_CounterMenus('theCounters', 'thetotalnumber') + " }}} + " Type {{{ + call <SID>Tex_CounterMenus('Type', 'alph') + call <SID>Tex_CounterMenus('Type', 'Alph') + call <SID>Tex_CounterMenus('Type', 'arabic') + call <SID>Tex_CounterMenus('Type', 'roman') + call <SID>Tex_CounterMenus('Type', 'Roman') + " }}} +endif + +" ============================================================================== +" Various +" ============================================================================== +if g:Tex_Menus + " Various {{{ + call <SID>Tex_VariousMenus('ref{}' , '\ref{<++>}<++>') + call <SID>Tex_VariousMenus('pageref{}' , '\pageref{<++>}<++>') + call <SID>Tex_VariousMenus('label{}' , '\label{<++>}<++>') + call <SID>Tex_VariousMenus('footnote{}' , '\footnote{<++>}<++>') + call <SID>Tex_VariousMenus('footnotemark{}', '\footnotemark{<++>}<++>') + call <SID>Tex_VariousMenus('footnotemark{}', '\footnotetext{<++>}<++>') + call <SID>Tex_VariousMenus('cite{}' , '\cite{<++>}<++>') + call <SID>Tex_VariousMenus('nocite{}' , '\nocite{<++>}<++>') + " }}} +endif + +if g:Tex_CatchVisMapErrors + exe "vnoremap ".g:Tex_Leader." :\<C-u>call ExecMap('".g:Tex_Leader."', 'v')\<CR>" +endif +" this is for avoiding reinclusion of imaps from next time on. +let s:doneOnce = 1 + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/envmacros.vim b/vim-latex/ftplugin/latex-suite/envmacros.vim new file mode 100644 index 0000000..b989fc6 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/envmacros.vim @@ -0,0 +1,1166 @@ +"============================================================================= +" File: envmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 08:00 PM 2002 PST +" CVS Header: $Id: envmacros.vim 1101 2010-01-28 23:30:56Z tmaas $ +" Description: mappings/menus for environments. +"============================================================================= + +if !g:Tex_EnvironmentMaps && !g:Tex_EnvironmentMenus + finish +endif + +exe 'so '.fnameescape(expand('<sfile>:p:h').'/wizardfuncs.vim') + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +" Define environments for IMAP evaluation " {{{ +let s:figure = "\\begin{figure}[<+htpb+>]\<cr>\\begin{center}\<cr>\\psfig{figure=<+eps file+>}\<cr>\\end{center}\<cr>\\caption{<+caption text+>}\<cr>\\label{fig:<+label+>}\<cr>\\end{figure}<++>" +let s:figure_graphicx = "\\begin{figure}[<+htpb+>]\<cr>\\begin{center}\<cr>\\includegraphics{<+file+>}\<cr>\\end{center}\<cr>\\caption{<+caption text+>}\<cr>\\label{fig:<+label+>}\<cr>\\end{figure}<++>" +let s:minipage = "\\begin{minipage}[<+tb+>]{<+width+>}\<cr><++>\<cr>\\end{minipage}<++>" +let s:picture = "\\begin{picture}(<+width+>, <+height+>)(<+xoff+>,<+yoff+>)\<cr>\\put(<+xoff+>,<+yoff+>){\\framebox(<++>,<++>){<++>}}\<cr>\\end{picture}<++>" +let s:list = "\\begin{list}{<+label+>}{<+spacing+>}\<cr>\\item <++>\<cr>\\end{list}<++>" +let s:table = "\\begin{table}\<cr>\\centering\<cr>\\begin{tabular}{<+dimensions+>}\<cr><++>\<cr>\\end{tabular}\<cr>\\caption{<+Caption text+>}\<cr>\\label{tab:<+label+>}\<cr>\\end{table}<++>" +let s:array = "\\left<++>\<cr>\\begin{array}{<+dimension+>}\<cr><+elements+>\<cr>\\end{array}\<cr>\\right<++>" +let s:description ="\\begin{description}\<cr>\\item[<+label+>]<++>\<cr>\\end{description}<++>" +let s:document = "\\documentclass[<+options+>]{<+class+>}\<cr>\<cr>\\begin{document}\<cr><++>\<cr>\\end{document}" +let s:tabular = "\\begin{tabular}[<+hbtp+>]{<+format+>}\<cr><++>\<cr>\\end{tabular}" +let s:tabular_star = "\\begin{tabular*}[<+hbtp+>]{<+format+>}\<cr><++>\<cr>\\end{tabular*}" + +" }}} +" define environments with special behavior in line wise selection. {{{ +if !exists('s:vis_center_left') + let s:vis_center_left = '\centerline{' + let s:vis_center_right = '}' + + let s:vis_verbatim_left = '\verb\|' + let s:vis_verbatim_right = '\|' + + let s:vis_flushright_left = '{\raggedright ' + let s:vis_flushright_right = '}' + + let s:vis_fushleft_left = '{\raggedleft ' + let s:vis_fushleft_right = '}' + + let s:vis_lrbox_left = '\sbox{' + let s:vis_lrbox_right = '}' +endif +" }}} +" Tex_EnvMacros: sets up maps and menus for environments {{{ +" Description: +function! <SID>Tex_EnvMacros(lhs, submenu, name) + + let extra = '' + if a:submenu =~ 'Lists' + let extra = '\item ' + endif + + let vright = '' + let vleft = '' + if exists('s:vis_'.a:name.'_right') + let vright = s:vis_{a:name}_right + let vleft = s:vis_{a:name}_left + endif + let vrhs = "\<C-\\>\<C-N>:call VEnclose('".vleft."', '".vright."', '\\begin{".a:name."}', '\\end{".a:name."}')\<CR>" + let location = g:Tex_EnvMenuLocation.a:submenu.a:name.'<tab>' + + if a:lhs != '' + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let location = location.a:lhs.'\ ('.vlhs.')' + + if g:Tex_EnvironmentMaps && !exists('s:doneOnce') + call IMAP(a:lhs, "\<C-r>=Tex_PutEnvironment('".a:name."')\<CR>", 'tex') + exec 'vnoremap <silent> '.vlhs.' '.vrhs + endif + + endif + + if g:Tex_Menus && g:Tex_EnvironmentMenus && has("gui_running") + exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' + exe 'vmenu '.location.' '.vrhs + endif + +endfunction + +" }}} +" Tex_SpecialMacros: macros with special right hand sides {{{ +" Description: +function! <SID>Tex_SpecialMacros(lhs, submenu, name, irhs, ...) + + let wiz = 1 + if a:0 > 0 && a:1 == 0 + let wiz = 0 + endif + + let location = g:Tex_EnvMenuLocation.a:submenu.a:name + + let vright = '' + let vleft = '' + if exists('s:vis_'.a:name.'_right') + let vright = s:vis_{a:name}_right + let vleft = s:vis_{a:name}_left + endif + let vrhs = "\<C-\\>\<C-N>:call VEnclose('".vleft."', '".vright."', '\\begin{".a:name."}', '\\end{".a:name."}')\<CR>" + + if a:lhs != '' + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let location = location.'<tab>'.a:lhs.'\ ('.vlhs.')' + + if g:Tex_EnvironmentMaps && !exists('s:doneOnce') + call IMAP(a:lhs, a:irhs, 'tex') + exec 'vnoremap '.vlhs.' '.vrhs + endif + + endif + + if g:Tex_Menus && g:Tex_EnvironmentMenus + if wiz + exe 'amenu '.location.' <plug><C-r>=Tex_DoEnvironment("'.a:name.'")<CR>' + else + exe 'amenu '.location." <plug><C-r>=IMAP_PutTextWithMovement('".a:irhs."')<CR>" + endif + exe 'vmenu '.location.' '.vrhs + endif + +endfunction " }}} +" Tex_SectionMacros: creates section maps and menus {{{ +" Description: +function! <SID>Tex_SectionMacros(lhs, name) + + let vlhs = g:Tex_Leader2.substitute(tolower(a:lhs), '^.', '', '') + let vrhs = "\<C-\\>\<C-N>:call VEnclose('\\".a:name."{', '}', '', '')<CR>" + + if g:Tex_SectionMaps && !exists('s:doneOnce') + exe 'vnoremap '.vlhs.' '.vrhs + call IMAP (a:lhs, "\\".a:name.'{<++>}<++>', 'tex') + endif + + if g:Tex_Menus && g:Tex_SectionMenus + let location = g:Tex_EnvMenuLocation.'Sections.'.a:name.'<tab>'.a:lhs.'\ ('.vlhs.')' + let advlocation = g:Tex_EnvMenuLocation.'Sections.Advanced.'.a:name + + let irhs = "\<C-r>=IMAP_PutTextWithMovement('\\".a:name."{<++>}<++>')\<CR>" + + let advirhs = "\<C-r>=Tex_InsSecAdv('".a:name."')\<CR>" + let advvrhs = "\<C-\\>\<C-N>:call Tex_VisSecAdv('".a:name."')\<CR>" + + exe 'amenu '.advlocation.' <plug>'.advirhs + exe 'vnoremenu '.advlocation." ".advvrhs + + exe 'amenu '.location.' <plug>'.irhs + exe 'vnoremenu '.location." ".vrhs + endif +endfunction " }}} + +" NewEnvironments {{{ +call s:Tex_SpecialMacros('', '', 'newenvironment', '\newenvironment{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'newenvironment*', '\newenvironment*{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'renewenvironment', '\renewenvironment{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', 'renewenvironment*', '\renewenvironment*{<++>}[<++>][<++>]{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', '', '-sepenv0-', ' :', 0) +" }}} +" Environments specific commands {{{ +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', '&item', '\item', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', 'i&tem[]', '\item[<++>]<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Lists.', '&bibitem{}', '\bibitem{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&=', '\=', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&>', '\>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&\\\\', '\\', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&+', '\+', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&-', '\-', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', "\\\'", "\\\'", 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&`', '\`', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '\\&kill', '\kill', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&makron\ \\CHAR=', '\<++>=<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', "&aigu\ \\CHAR\'", "\\<++>\'<++>", 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', '&grave\ \\CHAR`', '\<++>`<++>', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', 'p&ushtabs', '\pushtabs', 0) +call s:Tex_SpecialMacros('', 'Env&Commands.&Tabbing.', 'p&optabs', '\poptabs', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&hline', '\hline', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&cline', '\cline', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&\&', '&', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&\\\\', '\\', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Tabular.', '&multicolumn{}{}{}', '\multicolumn{<++>}{<++>}{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&makelabels', '\makelabels', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&address', '\address', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&signature', '\signature', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&date', '\date', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '-sepenva4-', ' :', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&opening{}', '\opening{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&closing{}', '\closing{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', '&ps{}', '\ps{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.Le&tter.', 'cc&{}', '\cc{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&onlyslides{}', '\onlyslides{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&onlynotes{}', '\onlynotes{<++>}<++>', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '-sepenva5-', ' :', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&invisible', '\invisible', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&visible', '\visible', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&settime', '\settime', 0) +call s:Tex_SpecialMacros('', 'EnvCommands.&Slides.', '&addtime', '\addtime', 0) +call s:Tex_SpecialMacros('', '', '-sepenv0-', ' :', 0) +" }}} +" Lists {{{ +call s:Tex_SpecialMacros('ELI', '&Lists.', 'list', s:list) +call s:Tex_SpecialMacros('EDE', '&Lists.', 'description', s:description) +call s:Tex_EnvMacros('EEN', '&Lists.', 'enumerate') +call s:Tex_EnvMacros('EIT', '&Lists.', 'itemize') +call s:Tex_EnvMacros('ETI', '&Lists.', 'theindex') +call s:Tex_EnvMacros('ETL', '&Lists.', 'trivlist') +" }}} +" Tables {{{ +call s:Tex_SpecialMacros('ETE', '&Tables.', 'table', s:table) +call s:Tex_EnvMacros('ETG', '&Tables.', 'tabbing') +call s:Tex_EnvMacros('', '&Tables.', 'table*') +call s:Tex_EnvMacros('', '&Tables.', 'table2') +call s:Tex_SpecialMacros('ETR', '&Tables.', 'tabular', s:tabular) +call s:Tex_SpecialMacros('', '&Tables.', 'tabular*', s:tabular_star) +" }}} +" Math {{{ +call s:Tex_EnvMacros('EAR', '&Math.', 'array') +call s:Tex_EnvMacros('EDM', '&Math.', 'displaymath') +call s:Tex_EnvMacros('EEA', '&Math.', 'eqnarray') +call s:Tex_EnvMacros('', '&Math.', 'eqnarray*') +call s:Tex_EnvMacros('EEQ', '&Math.', 'equation') +call s:Tex_EnvMacros('EMA', '&Math.', 'math') +" }}} +" Structure {{{ +call s:Tex_SpecialMacros('EAR', 'Math.', 'array', s:array) +call s:Tex_EnvMacros('EAB', '&Structure.', 'abstract') +call s:Tex_EnvMacros('EAP', '&Structure.', 'appendix') +call s:Tex_EnvMacros('ECE', '&Structure.', 'center') +call s:Tex_EnvMacros('EDO', '&Structure.', 'document') +call s:Tex_EnvMacros('EFC', '&Structure.', 'filecontents') +call s:Tex_EnvMacros('', '&Structure.', 'filecontents*') +call s:Tex_EnvMacros('EFL', '&Structure.', 'flushleft') +call s:Tex_EnvMacros('EFR', '&Structure.', 'flushright') +call s:Tex_EnvMacros('EQN', '&Structure.', 'quotation') +call s:Tex_EnvMacros('EQE', '&Structure.', 'quote') +call s:Tex_EnvMacros('ESP', '&Structure.', 'sloppypar') +call s:Tex_EnvMacros('ETI', '&Structure.', 'theindex') +call s:Tex_EnvMacros('ETP', '&Structure.', 'titlepage') +call s:Tex_EnvMacros('EVM', '&Structure.', 'verbatim') +call s:Tex_EnvMacros('', '&Structure.', 'verbatim*') +call s:Tex_EnvMacros('EVE', '&Structure.', 'verse') +call s:Tex_EnvMacros('ETB', '&Structure.', 'thebibliography') +call s:Tex_SpecialMacros('', '&Structure.', '-sepstruct0-', ':', 0) +call s:Tex_EnvMacros('ENO', '&Structure.', 'note') +call s:Tex_EnvMacros('EOV', '&Structure.', 'overlay') +call s:Tex_EnvMacros('ESL', '&Structure.', 'slide') +" }}} +" Sections {{{ +call s:Tex_SectionMacros('SPA', 'part') +call s:Tex_SectionMacros('SCH', 'chapter') +call s:Tex_SectionMacros('SSE', 'section') +call s:Tex_SectionMacros('SSS', 'subsection') +call s:Tex_SectionMacros('SS2', 'subsubsection') +call s:Tex_SectionMacros('SPG', 'paragraph') +call s:Tex_SectionMacros('SSP', 'subparagraph') +" }}} +" Miscellaneous {{{ +call s:Tex_SpecialMacros('', '', '-sepenv1-', ' :', 0) +call s:Tex_SpecialMacros('EFI', '', 'figure', "\<C-r>=Tex_PutEnvironment('figure')\<CR>") +call s:Tex_EnvMacros('', '', 'figure*') +call s:Tex_EnvMacros('ELR', '', 'lrbox') +call s:Tex_SpecialMacros('EMP', '', 'minipage', s:minipage) +call s:Tex_SpecialMacros('EPI', '', 'picture', s:picture) +" }}} + +if g:Tex_CatchVisMapErrors + exe 'vnoremap '.g:Tex_Leader2." :\<C-u>call ExecMap('".g:Tex_Leader2."', 'v')\<CR>" +endif + +" ============================================================================== +" Specialized functions for various environments +" +" All these functions are to be used as: +" +" inoremap <lhs> <C-r>=Tex_itemize('enumerate')<CR> +" nnoremap <lhs> i<C-r>=Tex_itemize('enumerate')<CR> +" +" and so on... +" ============================================================================== +" Tex_itemize: {{{ +function! Tex_itemize(env) + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr>\\item <++>\<cr>\\end{".a:env."}<++>") +endfunction +" }}} +" Tex_description: {{{ +function! Tex_description(env) + if g:Tex_UseMenuWizard == 1 + let itlabel = input('(Optional) Item label? ') + if itlabel != '' + let itlabel = '['.itlabel.']' + endif + return IMAP_PutTextWithMovement("\\begin{description}\<cr>\\item".itlabel." <++>\<cr>\\end{description}<++>") + else + return IMAP_PutTextWithMovement(s:description) + endif +endfunction +" }}} +" Tex_figure: {{{ +function! Tex_figure(env) + if g:Tex_UseMenuWizard == 1 + let flto = input('Float to (htbp)? ') + let caption = input('Caption? ') + let center = input('Center ([y]/n)? ') + let label = input('Label (for use with \ref)? ') + " additional to AUC Tex since my pics are usually external files + let pic = input('Name of Pic-File? ') + if flto != '' + let flto = '['.flto."]\<cr>" + else + let flto = "\<cr>" + endif + if pic != '' + let pic = '\input{'.pic."}\<cr>" + else + let pic = "<++>\<cr>" + endif + if caption != '' + let caption = '\caption{'.caption."}\<cr>" + endif + if label != '' + let label = '\label{fig:'.label."}\<cr>" + endif + if center == 'y' + let centr = '\begin{center}' . "\<cr>" + let centr = centr . pic + let centr = centr . caption + let centr = centr . label + let centr = centr . '\end{center}' . "\<cr>" + else + let centr = pic + let centr = centr . caption + let centr = centr . label + endif + let figure = '\begin{'.a:env.'}'.flto + let figure = figure . centr + let figure = figure . '\end{'.a:env.'}' + return IMAP_PutTextWithMovement(figure) + else + if g:Tex_package_detected =~ '\<graphicx\>' + return IMAP_PutTextWithMovement(s:figure_graphicx) + else + return IMAP_PutTextWithMovement(s:figure) + endif + endif +endfunction +" }}} +" Tex_table: {{{ +function! Tex_table(env) + if g:Tex_UseMenuWizard == 1 + let flto = input('Float to (htbp)? ') + let caption = input('Caption? ') + let center = input('Center (y/n)? ') + let label = input('Label? ') + if flto != '' + let flto ='['.flto."]\<cr>" + else + let flto = '' + endif + let ret='\begin{table}'.flto + if center == 'y' + let ret=ret."\\begin{center}\<cr>" + endif + let foo = '\begin{tabular}' + let pos = input('(Optional) Position (t b)? ') + if pos != '' + let foo = foo.'['.pos.']' + else + let foo = foo."\<cr>" + endif + let format = input("Format ( l r c p{width} | @{text} )? ") + if format == '' + let format = '<++>' + endif + let ret = ret.foo.'{'.format."}\<cr><++>\<cr>\\end{tabular}<++>\<cr>" + if center == 'y' + let ret=ret."\\end{center}\<cr>" + endif + if caption != '' + let ret=ret.'\caption{'.caption."}\<cr>" + endif + if label != '' + let ret=ret.'\label{tab:'.label."}\<cr>" + endif + let ret=ret.'\end{table}<++>' + return IMAP_PutTextWithMovement(ret) + else + return IMAP_PutTextWithMovement(s:table) + endif +endfunction +" }}} +" Tex_tabular: {{{ +function! Tex_tabular(env) + if g:Tex_UseMenuWizard == 1 + let pos = input('(Optional) Position (t b)? ') + let format = input("Format ( l r c p{width} | @{text} )? ") + if pos != '' + let pos = '['.pos.']' + endif + if format != '' + let format = '{'.format.'}' + endif + return IMAP_PutTextWithMovement('\begin{'.a:env.'}'.pos.format."\<cr> \<cr>\\end{".a:env.'}<++>') + else + return IMAP_PutTextWithMovement('\begin{'.a:env.'}[<+position+>]{<+format+>}'."\<cr><++>\<cr>\\end{".a:env.'}<++>') + endif +endfunction +" }}} +" Tex_eqnarray: {{{ +function! Tex_eqnarray(env) + if g:Tex_UseMenuWizard == 1 + if a:env !~ '\*' + let label = input('Label? ') + if label != '' + let arrlabel = '\label{'.label."}\<cr>" + else + let arrlabel = '' + endif + else + let arrlabel = '' + endif + else + if a:env !~ '\*' + let arrlabel = "\\label{<++>}\<cr>" + else + let arrlabel = "" + endif + endif + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>".arrlabel."\\end{".a:env."}<++>") +endfunction +" }}} +" Tex_list: {{{ +function! Tex_list(env) + if g:Tex_UseMenuWizard == 1 + let label = input('Label (for \item)? ') + if label != '' + let label = '{'.label.'}' + let addcmd = input('Additional commands? ') + if addcmd != '' + let label = label . '{'.addcmd.'}' + endif + else + let label = '' + endif + return IMAP_PutTextWithMovement('\begin{list}'.label."\<cr>\\item \<cr>\\end{list}<++>") + else + return IMAP_PutTextWithMovement(s:list) + endif +endfunction +" }}} +" Tex_document: {{{ +function! Tex_document(env) + if g:Tex_UseMenuWizard == 1 + let dstyle = input('Document style? ') + let opts = input('(Optional) Options? ') + let foo = '\documentclass' + if opts == '' + let foo = foo.'{'.dstyle.'}' + else + let foo = foo.'['.opts.']'.'{'.dstyle.'}' + endif + return IMAP_PutTextWithMovement(foo."\<cr>\<cr>\\begin{document}\<cr><++>\<cr>\\end{document}") + else + return IMAP_PutTextWithMovement(s:document) + endif +endfunction +" }}} +" Tex_minipage: {{{ +function! Tex_minipage(env) + if g:Tex_UseMenuWizard == 1 + let foo = '\begin{minipage}' + let pos = input('(Optional) Position (t b)? ') + let width = input('Width? ') + if pos == '' + let foo = foo.'{'.width.'}' + else + let foo = foo.'['.pos.']{'.width.'}' + endif + return IMAP_PutTextWithMovement(foo."\<cr><++>\<cr>\\end{minipage}<++>") + else + return IMAP_PutTextWithMovement(s:minipage) + endif +endfunction +" }}} +" Tex_thebibliography: {{{ +function! Tex_thebibliography(env) + if g:Tex_UseMenuWizard == 1 + " AUC Tex: "Label for BibItem: 99" + let indent = input('Indent for BibItem? ') + let foo = '{'.indent.'}' + let biblabel = input('(Optional) Bibitem label? ') + let key = input('Add key? ') + let bar = '\bibitem' + if biblabel != '' + let bar = bar.'['.biblabel.']' + endif + let bar = bar.'{'.key.'}' + return IMAP_PutTextWithMovement('\begin{thebibliography}'.foo."\<cr>".bar." \<cr>\\end{thebibliography}<++>\<Up>") + else + return IMAP_PutTextWithMovement( + \ "\\begin{thebibliography}\<CR>". + \ "\\bibitem[<+biblabel+>]{<+bibkey+>} <++>\<CR>". + \ "<++>\<CR>". + \ "\\end{thebibliography}<++>") + endif +endfunction +" }}} + +" ============================================================================== +" Contributions / suggestions from Carl Mueller (auctex.vim) +" ============================================================================== +" PromptForEnvironment: prompts for an environment {{{ +" Description: +function! PromptForEnvironment(ask) + return Tex_ChooseFromPrompt( + \ a:ask."\n" . + \ Tex_CreatePrompt(g:Tex_PromptedEnvironments, 2, ",") . + \ "\nEnter name or number of environment :", + \ g:Tex_PromptedEnvironments, ",") +endfunction " }}} +" Tex_DoEnvironment: fast insertion of environments {{{ +" Description: +" The menus call this function with an argument (the name of the environment +" to insert). The maps call this without any arguments. In this case, it +" prompts for an environment to enter if the current line is empty. If +" called without arguments and there is a word on the current line, then use +" that as the name of a new environment. +function! Tex_DoEnvironment(...) + if a:0 < 1 + let env = matchstr(getline('.'), '^\s*\zs\w*\*\=\ze\s*$') + " If in current line is more than one word or in visual mode + " ignore contents of line and prompt for environment + if env == '' || (exists('s:isvisual') && s:isvisual == 'yes') + let env = PromptForEnvironment('Choose which environment to insert: ') + if env != '' + return Tex_PutEnvironment(env) + else + return '' + endif + else + " delete the word on the line into the blackhole register. + normal! 0"_D + return Tex_PutEnvironment(env) + endif + else + return Tex_PutEnvironment(a:1) + endif +endfunction " }}} +" Tex_PutEnvironment: calls various specialized functions {{{ +" Description: +" Based on input argument, it calls various specialized functions. +function! Tex_PutEnvironment(env) + if exists("s:isvisual") && s:isvisual == "yes" + let s:isvisual = 'no' + if a:env == '\[' + return VEnclose('', '', '\[', '\]') + elseif a:env == '$$' + return VEnclose('', '', '$$', '$$') + endif + return VEnclose('\begin{'.a:env.'}', '\end{'.a:env.'}', '\begin{'.a:env.'}', '\end{'.a:env.'}') + else + " The user can define something like + " let g:Tex_Env_theorem = "\\begin{theorem}\<CR><++>\<CR>\\end{theorem}" + " This will effectively over-write the default definition of the + " theorem environment which uses a \label. + if exists("b:Tex_Env_{'".a:env."'}") + return IMAP_PutTextWithMovement(b:Tex_Env_{a:env}) + elseif exists("g:Tex_Env_{'".a:env."'}") + return IMAP_PutTextWithMovement(g:Tex_Env_{a:env}) + elseif a:env =~ 'equation*\|eqnarray*\|theorem\|lemma\|equation\|eqnarray\|align\*\|align\>\|multline' + let g:aa = a:env + return Tex_eqnarray(a:env) + elseif a:env =~ "enumerate\\|itemize\\|theindex\\|trivlist" + return Tex_itemize(a:env) + elseif a:env =~ "table\\|table*" + return Tex_table(a:env) + elseif a:env =~ "tabular\\|tabular*\\|array\\|array*" + return Tex_tabular(a:env) + elseif exists('*Tex_'.a:env) + exe 'return Tex_'.a:env.'(a:env)' + elseif a:env == '$$' + return IMAP_PutTextWithMovement('$$<++>$$') + elseif a:env == '\[' + return IMAP_PutTextWithMovement("\\[\<CR><++>\<CR>\\]<++>") + else + " Look in supported packages if exists template for environment + " given in the line + if exists('g:Tex_package_supported') && g:Tex_package_supported != '' + let i = 1 + while Tex_Strntok(g:Tex_package_supported, ',', i) != '' + let checkpack = Tex_Strntok(g:Tex_package_supported, ',', i) + if g:TeX_package_{checkpack} =~ 'e..:'.a:env + if a:env =~ '*' + " Don't allow * to be treated as wildcard + let aenv = substitute(a:env, '*', '\\*', '') + else + let aenv = a:env + endif + let envcommand = matchstr(g:TeX_package_{checkpack}, '\zse..:'.aenv.'[^,]\{-}\ze,') + return Tex_ProcessPackageCommand(envcommand) + endif + let i = i + 1 + endwhile + endif + endif + " If nothing before us managed to create an environment, then just + " create a bare-bones environment from the name. + return IMAP_PutTextWithMovement('\begin{'.a:env."}\<cr><++>\<cr>\\end{".a:env."}<++>") + endif +endfunction " }}} +" Mapping the <F5> key to insert/prompt for an environment/package {{{ +" and <S-F5> to prompt/replace an environment +" +" g:Tex_PromptedEnvironments is a variable containing a comma seperated list +" of environments. This list defines the prompt which latex-suite sets up when +" the user presses <F5> on an empty line. +" +" Leaving this empty is equivalent to disabling the feature. +if g:Tex_PromptedEnvironments != '' + + let b:DoubleDollars = 0 + + " Provide only <plug>s here. main.vim will create the actual maps. + inoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-r>=Tex_FastEnvironmentInsert("no")<cr> + nnoremap <silent> <Plug>Tex_FastEnvironmentInsert i<C-r>=Tex_FastEnvironmentInsert("no")<cr> + vnoremap <silent> <Plug>Tex_FastEnvironmentInsert <C-\><C-N>:call Tex_FastEnvironmentInsert("yes")<CR> + inoremap <silent> <Plug>Tex_FastEnvironmentChange <C-O>:call Tex_ChangeEnvironments()<CR> + nnoremap <silent> <Plug>Tex_FastEnvironmentChange :call Tex_ChangeEnvironments()<CR> + + " Tex_FastEnvironmentInsert: maps <F5> to prompt for env and insert it " {{{ + " Description: + " This function calculates whether we are in the preamble. If we are + " then inserts a \usepackage line by either reading in a word from the + " current line or prompting to type in one. If not in the preamble, then + " inserts a environment template either by reading in a word from the + " current line or prompting the user to choose one. + " + function! Tex_FastEnvironmentInsert(isvisual) + + let start_line = line('.') + let pos = Tex_GetPos() + let s:isvisual = a:isvisual + + " decide if we are in the preamble of the document. If we are then + " insert a package, otherwise insert an environment. + " + if search('\\documentclass', 'bW') && search('\\begin{document}') + + " If there is a \documentclass line and a \begin{document} line in + " the file, then a part of the file is the preamble. + + " search for where the document begins. + let begin_line = search('\\begin{document}') + " if the document begins after where we are presently, then we are + " in the preamble. + if start_line < begin_line + " return to our original location and insert a package + " statement. + call Tex_SetPos(pos) + return Tex_package_from_line() + else + " we are after the preamble. insert an environment. + call Tex_SetPos(pos) + return Tex_DoEnvironment() + endif + + elseif search('\\documentclass') + " if there is only a \documentclass but no \begin{document}, then + " the entire file is a preamble. Put a package. + + call Tex_SetPos(pos) + return Tex_package_from_line() + + else + " no \documentclass, put an environment. + + call Tex_SetPos(pos) + return Tex_DoEnvironment() + + endif + + endfunction + + " }}} + " Tex_package_from_line: puts a \usepackage line in the current line. " {{{ + " Description: + " + function! Tex_package_from_line() + " Function Tex_PutPackage is defined in packages.vim + " Ignores <F5> in Visual mode + if s:isvisual == "yes" + return 0 + else + let l = getline(".") + let pack = matchstr(l, '^\s*\zs.*') + normal! 0"_D + return Tex_pack_one(pack) + endif + endfunction + + " }}} + " Tex_ChangeEnvironments: calls Change() to change the environment {{{ + " Description: + " Finds out which environment the cursor is positioned in and changes + " that to the chosen new environment. This function knows the changes + " which need to be made to change one env to another and calls + " Change() with the info. + " + function! Tex_ChangeEnvironments() + + let env_line = searchpair('$$\|\\[\|begin{', '', '$$\|\\]\|end{', "bn") + + if env_line != 0 + if getline(env_line) !~ 'begin{' + let env_name = '[' + else + let env_name = matchstr(getline(env_line), 'begin{\zs.\{-}\ze}') + endif + endif + + if !exists('env_name') + echomsg "You are not inside environment" + return 0 + endif + + exe 'echomsg "You are within a '.env_name.' environment."' + let change_env = PromptForEnvironment('What do you want to change it to? ') + + if change_env == 'eqnarray' + call <SID>Change('eqnarray', 1, '', env_name =~ '\*$') + elseif change_env == 'align' + call <SID>Change('align', 1, '', env_name =~ '\*$') + elseif change_env == 'eqnarray*' + call <SID>Change('eqnarray*', 0, '\\nonumber', 0) + elseif change_env == 'align*' + call <SID>Change('align*', 0, '\\nonumber', 0) + elseif change_env == 'equation*' + call <SID>Change('equation*', 0, '&\|\\lefteqn{\|\\nonumber\|\\\\', 0) + elseif change_env == '' + return 0 + else + call <SID>Change(change_env, 0, '', '') + return 0 + endif + + endfunction + + " }}} + " Change: changes the current env to the new env {{{ + " Description: + " This function needs to know the changes which need to be made while + " going from an old environment to a new one. This info, it gets from + " Tex_ChangeEnvironments + " + " env : name of the new environment. + " label : if 1, then insert a \label at the end of the environment. + " otherwise, delete any \label line found. + " delete : a pattern which is to be deleted from the original environment. + " for example, going to a eqnarray* environment means we need to + " delete \label's. + " putInNonumber : whether we need to put a \nonumber before the end of the + " environment. + function! s:Change(env, label, delete, putInNonumber) + + let start_line = line('.') + let start_col = virtcol('.') + + if a:env == '[' + if b:DoubleDollars == 0 + let first = '\\[' + let second = '\\]' + else + let first = '$$' + let second = '$$' + endif + else + let first = '\\begin{' . a:env . '}' + let second = '\\end{' . a:env . '}' + endif + + if b:DoubleDollars == 0 + let bottom = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','') + s/\\\]\|\\end{.\{-}}/\=second/ + let top = searchpair('\\\[\|\\begin{','','\\\]\|\\end{','b') + s/\\\[\|\\begin{.\{-}}/\=first/ + else + let bottom = search('\$\$\|\\end{') + s/\$\$\|\\end{.\{-}}/\=second/ + let top = search('\$\$\|\\begin{','b') + s/\$\$\|\\begin{.\{-}}/\=first/ + end + if a:delete != '' + exe 'silent '. top . "," . bottom . 's/' . a:delete . '//e' + endif + + if a:putInNonumber == 1 + exe top + call search('\\end\|\\\\') + if line('.') != bottom + exe '.+1,' . bottom . 's/\\\\/\\nonumber\\\\/e' + exe (bottom-1) . 's/\s*$/ \\nonumber/' + endif + endif + + if a:label == 1 + exe top + if search("\\label", "W") > bottom + exe top + let local_label = input('Label? ') + if local_label != '' + put = '\label{'.local_label.'}' + endif + normal $ + endif + else + exe 'silent '.top . ',' . bottom . ' g/\\label/delete' + endif + + if exists('local_label') && local_label != '' + exe start_line + 1.' | normal! '.start_col.'|' + else + exe start_line.' | normal! '.start_col.'|' + endif + endfunction " }}} + +endif + +" }}} +" Map <S-F1> through <S-F4> to insert environments {{{ +if g:Tex_HotKeyMappings != '' + + " SetUpHotKeys: maps <F1> through <F4> to insert environments + " Description: + function! <SID>SetUpHotKeys() + let i = 1 + let envname = Tex_Strntok(g:Tex_HotKeyMappings, ',', i) + while envname != '' + + exec 'inoremap <silent> <buffer> <S-F'.i.'> <C-r>=Tex_PutEnvironment("'.envname.'")<CR>' + + let i = i + 1 + let envname = Tex_Strntok(g:Tex_HotKeyMappings, ',', i) + + endwhile + + endfunction + +endif + +" }}} +" Tex_SetFastEnvironmentMaps: function for setting up the <F5> and <S-F1>-<S-F4> keys {{{ +" Description: This function is made public so it can be called by the +" SetTeXOptions() function in main.vim +function! Tex_SetFastEnvironmentMaps() + if g:Tex_PromptedEnvironments != '' + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'i', '<silent> <buffer>') + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'n', '<silent> <buffer>') + call Tex_MakeMap("<F5>", "<Plug>Tex_FastEnvironmentInsert", 'v', '<silent> <buffer>') + call Tex_MakeMap("<S-F5>", "<Plug>Tex_FastEnvironmentChange", 'i', '<silent> <buffer>') + call Tex_MakeMap("<S-F5>", "<Plug>Tex_FastEnvironmentChange", 'n', '<silent> <buffer>') + endif + if g:Tex_HotKeyMappings != '' + call s:SetUpHotKeys() + endif +endfunction " }}} + +" ============================================================================== +" Contributions / Tex_InsertItem() from Johannes Tanzler +" ============================================================================== +" Tex_GetCurrentEnv: gets the current environment in which the cursor lies {{{ +" Description: handles cases such as: +" +" \begin{itemize} +" \item first item +" \item second item +" \begin{description} +" \item first desc +" \item second +" % Tex_GetCurrentEnv will return "description" when called from here +" \end{description} +" \item third item +" % Tex_GetCurrentEnv will return "itemize" when called from here +" \end{itemize} +" % Tex_GetCurrentEnv will return "" when called from here +" +" Author: Alan Schmitt +function! Tex_GetCurrentEnv() + let pos = Tex_GetPos() + let i = 0 + while 1 + let env_line = search('^[^%]*\\\%(begin\|end\){', 'bW') + if env_line == 0 + " we reached the beginning of the file, so we return the empty string + call Tex_SetPos(pos) + return '' + endif + if match(getline(env_line), '^[^%]*\\begin{') == -1 + " we found a \\end, so we keep searching + let i = i + 1 + continue + else + " we found a \\begin which has not been \\end'ed. we are done. + if i == 0 + let env = matchstr(getline(env_line), '\\begin{\zs.\{-}\ze}') + call Tex_SetPos(pos) + return env + else + " this \\begin closes a \\end, continue searching. + let i = i - 1 + continue + endif + endif + endwhile +endfunction +" }}} +" Tex_InsertItem: insert \item into a list {{{ +" Description: Find last \begin line, extract env name, return to the start +" position and insert proper \item, depending on env name. +" Env names are stored in g: variables it can be used by +" package files. + +TexLet g:Tex_ItemStyle_itemize = '\item ' +TexLet g:Tex_ItemStyle_enumerate = '\item ' +TexLet g:Tex_ItemStyle_theindex = '\item ' +TexLet g:Tex_ItemStyle_thebibliography = '\bibitem[<+biblabel+>]{<+bibkey+>} <++>' +TexLet g:Tex_ItemStyle_description = '\item[<+label+>] <++>' + +function! Tex_InsertItem() + " Get current enclosing environment + let env = Tex_GetCurrentEnv() + + if exists('g:Tex_ItemStyle_'.env) + return IMAP_PutTextWithMovement(g:Tex_ItemStyle_{env}) + else + return '' + endif +endfunction +" }}} +" Tex_SetItemMaps: sets the \item inserting maps for current buffer {{{ + +inoremap <script> <silent> <Plug>Tex_InsertItemOnThisLine <C-r>=Tex_InsertItem()<CR> +inoremap <script> <silent> <Plug>Tex_InsertItemOnNextLine <ESC>o<C-R>=Tex_InsertItem()<CR> + +function! Tex_SetItemMaps() + if !hasmapto("<Plug>Tex_InsertItemOnThisLine", "i") + imap <buffer> <M-i> <Plug>Tex_InsertItemOnThisLine + endif + if !hasmapto("<Plug>Tex_InsertItemOnNextLine", "i") + imap <buffer> <C-CR> <Plug>Tex_InsertItemOnNextLine + endif +endfunction " }}} + +" ============================================================================== +" Implementation of Fast Environment commands for LaTeX commands +" ============================================================================== +" Define certain commonly used command definitions {{{ + +TexLet g:Tex_Com_{'newtheorem'} = '\newtheorem{<+name+>}{<+caption+>}[<+within+>]' +TexLet g:Tex_Com_{'frac'} = '\frac{<+n+>}{<+d+>}<++>' + +" }}} +" PromptForCommand: prompts for a command {{{ +" Description: +function! PromptForCommand(ask) + let common_com_prompt = + \ Tex_CreatePrompt(g:Tex_PromptedCommands, 2, ',') . "\n" . + \ "Enter number or command name :" + + let inp = input(a:ask."\n".common_com_prompt) + if inp =~ '^[0-9]\+$' + let com = Tex_Strntok(g:Tex_PromptedCommands, ',', inp) + else + let com = inp + endif + + return com +endfunction " }}} +" Tex_DoCommand: fast insertion of commands {{{ +" Description: +" +function! Tex_DoCommand(isvisual) + " If the current line is empty or if a visual selection has been made, + " prompt for a new environment. + if getline('.') == '' || a:isvisual == 'yes' + let com = PromptForCommand('Choose a command to insert: ') + if com != '' + return Tex_PutCommand(com, a:isvisual) + else + return '' + endif + else + " We want to find out the word under the cursor without issuing + " any movement commands. + let presline = getline('.') + let c = col('.') + + let wordbef = matchstr(strpart(presline, 0, c-1), '\k\+\*\?$') + let wordaft = matchstr(strpart(presline, c-1), '^\k\+\*\?') + + let word = wordbef . wordaft + call Tex_Debug("Tex_DoCommand: wordbef = [".wordbef."], wordaft = [".wordaft."], word = [".word."]", 'env') + + " We use \<Del> instead of \<Bs> because \<Bs> does not work + " unless bs=2 + if word != '' + return substitute(wordbef, '.', "\<Left>", 'g') + \ . substitute(word, '.', "\<Del>", 'g') + \ . Tex_PutCommand(word, a:isvisual) + else + let cmd = PromptForCommand('Choose a command to insert: ') + if cmd != '' + return Tex_PutCommand(cmd, a:isvisual) + else + return '' + endif + endif + endif +endfunction " }}} +" Tex_PutCommand: calls various specialized functions {{{ +" Description: +" Based on input argument, it calls various specialized functions. +function! Tex_PutCommand(com, isvisual) + if a:isvisual == "yes" + if a:com == '$' + return VEnclose('$', '$', '$', '$') + elseif a:com == '\\(' + return VEnclose('\\(', '\\)', '\\(', '\\)') + else + return VEnclose("\\".a:com.'{', '}', "\\".a:com.'{', '}') + endif + else + if exists('b:Tex_Com_{"'.a:com.'"}') + return IMAP_PutTextWithMovement(b:Tex_Com_{a:com}) + elseif exists('g:Tex_Com_{"'.a:com.'"}') + return IMAP_PutTextWithMovement(g:Tex_Com_{a:com}) + elseif a:com == '$' + return IMAP_PutTextWithMovement('$<++>$') + else + return IMAP_PutTextWithMovement("\\".a:com.'{<++>}<++>') + endif + endif +endfunction " }}} +" Mapping the <F7> key to prompt/insert for command {{{ +" and <S-F7> to prompt/replace command +" +" g:Tex_PromptedCommands is a variable containing a comma seperated list +" of commands. +" +" Leaving this empty is equivalent to disabling the feature. +if g:Tex_PromptedCommands != '' + + let b:DoubleDollars = 0 + + inoremap <silent> <Plug>Tex_FastCommandInsert <C-r>=Tex_DoCommand('no')<cr> + nnoremap <silent> <Plug>Tex_FastCommandInsert i<C-r>=Tex_DoCommand('no')<cr> + vnoremap <silent> <Plug>Tex_FastCommandInsert <C-\><C-N>:call Tex_DoCommand('yes')<CR> + + inoremap <silent> <Plug>Tex_FastCommandChange <C-O>:call Tex_ChangeCommand('no')<CR> + nnoremap <silent> <Plug>Tex_FastCommandChange :call Tex_ChangeCommand('no')<CR> + + " Tex_ChangeCommand: calls ChangeCommand() to change the environment {{{ + " Description: + " Finds out which environment the cursor is positioned in and changes + " that to the chosen new environment. This function knows the changes + " which need to be made to change one env to another and calls + " ChangeCommand() with the info. + " + function! Tex_ChangeCommand(isvisual) + + let pos_com = Tex_GetPos() + + let com_line = searchpair('\\\k\{-}{', '', '}', 'b') + + if com_line != 0 + normal l + let com_name = expand('<cword>') + endif + + if !exists('com_name') + echomsg "You are not inside command" + call Tex_SetPos(pos_com) + return 0 + endif + + exe 'echomsg "You are within a '.com_name.' command."' + let change_com = PromptForCommand('Do you want to change it to (number or name)? ') + + if change_com == '' + call Tex_SetPos(pos_com) + return 0 + else + call <SID>ChangeCommand(change_com) + call Tex_SetPos(pos_com) + return 0 + endif + + endfunction + + " }}} + " ChangeCommand: Changes current command according to prompt menu {{{ + " Description: + " + function! s:ChangeCommand(newcom) + + exe 'normal! ct{'.a:newcom."\<Esc>" + + endfunction + " }}} + +endif + +" }}} +" Tex_SetFastCommandMaps: function for setting up the <F7> keys {{{ +" Description: This function is made public so it can be called by the +" SetTeXOptions() function in main.vim +function! Tex_SetFastCommandMaps() + if g:Tex_PromptedCommands != '' + if !hasmapto('<Plug>Tex_FastCommandInsert', 'i') + imap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + if !hasmapto('<Plug>Tex_FastCommandInsert', 'n') + nmap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + if !hasmapto('<Plug>Tex_FastCommandChange', 'i') + imap <silent> <buffer> <S-F7> <Plug>Tex_FastCommandChange + endif + if !hasmapto('<Plug>Tex_FastCommandChange', 'n') + nmap <silent> <buffer> <S-F7> <Plug>Tex_FastCommandChange + endif + if !hasmapto('<Plug>Tex_FastCommandInsert', 'v') + vmap <silent> <buffer> <F7> <Plug>Tex_FastCommandInsert + endif + endif +endfunction " }}} + +" SetEnvMacrosOptions: sets mappings for buffers {{{ +" " Description: +function! <SID>SetEnvMacrosOptions() + if exists('b:doneTexEnvMaps') + return + endif + let b:doneTexEnvMaps = 1 + if g:Tex_PromptedEnvironments != '' || g:Tex_HotKeyMappings != '' + call Tex_SetFastEnvironmentMaps() + endif + if g:Tex_PromptedCommands != '' + call Tex_SetFastCommandMaps() + endif + call Tex_SetItemMaps() +endfunction " }}} +" Catch the Filetype event so we set maps for each buffer {{{ +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('envmacros.vim: Catching LatexSuiteFileType event', 'env') | + \ call s:SetEnvMacrosOptions() +augroup END +" }}} + +" this statement has to be at the end. +let s:doneOnce = 1 + +" vim:fdm=marker:nowrap:noet:ff=unix diff --git a/vim-latex/ftplugin/latex-suite/folding.vim b/vim-latex/ftplugin/latex-suite/folding.vim new file mode 100644 index 0000000..b65407c --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/folding.vim @@ -0,0 +1,400 @@ +"============================================================================= +" File: folding.vim +" Author: Srinath Avadhanula +" modifications/additions by Zhang Linbo +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions to interact with Syntaxfolds.vim +"============================================================================= + +nnoremap <unique> <Plug>Tex_RefreshFolds :call MakeTexFolds(1)<cr> + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('folding.vim: catching LatexSuiteFileType', 'fold') | + \ call Tex_SetFoldOptions() +augroup END + +" Tex_SetFoldOptions: sets maps for every buffer {{{ +" Description: +function! Tex_SetFoldOptions() + if exists('b:doneSetFoldOptions') + return + endif + let b:doneSetFoldOptions = 1 + + setlocal foldtext=TexFoldTextFunction() + + if g:Tex_Folding && g:Tex_AutoFolding + call MakeTexFolds(0) + endif + + let s:ml = '<Leader>' + + call Tex_MakeMap(s:ml."rf", "<Plug>Tex_RefreshFolds", 'n', '<silent> <buffer>') + +endfunction " }}} +" Tex_FoldSections: creates section folds {{{ +" Author: Zhang Linbo +" Description: +" This function takes a comma seperated list of "sections" and creates fold +" definitions for them. The first item is supposed to be the "shallowest" field +" and the last is the "deepest". See g:Tex_FoldedSections for the default +" definition of the lst input argument. +" +" **works recursively** +function! Tex_FoldSections(lst, endpat) + let i = match(a:lst, ',') + if i > 0 + let s = strpart(a:lst, 0, i) + else + let s = a:lst + endif + if s =~ '%%fakesection' + let s = '^\s*' . s + else + let pattern = '' + let prefix = '' + for label in split(s, "|") + let pattern .= prefix . '^\s*\\' . label . '\W\|^\s*%%fake' . label + let prefix = '\W\|' + endfor + let s = pattern + endif + let endpat = s . '\|' . a:endpat + if i > 0 + call Tex_FoldSections(strpart(a:lst,i+1), endpat) + endif + let endpat = '^\s*\\appendix\W\|' . endpat + call AddSyntaxFoldItem(s, endpat, 0, -1) +endfunction +" }}} +" MakeTexFolds: function to create fold items for latex. {{{ +" +" used in conjunction with MakeSyntaxFolds(). +" see ../plugin/syntaxFolds.vim for documentation +function! MakeTexFolds(force) + if exists('g:Tex_Folding') && !g:Tex_Folding + return + endif + if &ft != 'tex' + return + end + + " Setup folded items lists g:Tex_Foldedxxxx + " 1. Use default value if g:Tex_Foldedxxxxxx is not defined + " 2. prepend default value to g:Tex_Foldedxxxxxx if it starts with ',' + " 3. append default value to g:Tex_Foldedxxxxxx if it ends with ',' + + " Folding items which are not caught in any of the standard commands, + " environments or sections. + let s = 'item,slide,preamble,<<<' + if !exists('g:Tex_FoldedMisc') + let g:Tex_FoldedMisc = s + elseif g:Tex_FoldedMisc[0] == ',' + let g:Tex_FoldedMisc = s . g:Tex_FoldedMisc + elseif g:Tex_FoldedMisc =~ ',$' + let g:Tex_FoldedMisc = g:Tex_FoldedMisc . s + endif + + " By default do not fold any commands. It looks like trying to fold + " commands is a difficult problem since commands can be arbitrarily nested + " and the end patterns are not unique unlike the case of environments. + " For this to work well, we need a regexp which will match a line only if + " a command begins on that line but does not end on that line. This + " requires a regexp which will match unbalanced curly braces and that is + " apparently not doable with regexps. + let s = '' + if !exists('g:Tex_FoldedCommands') + let g:Tex_FoldedCommands = s + elseif g:Tex_FoldedCommands[0] == ',' + let g:Tex_FoldedCommands = s . g:Tex_FoldedCommands + elseif g:Tex_FoldedCommands =~ ',$' + let g:Tex_FoldedCommands = g:Tex_FoldedCommands . s + endif + + let s = 'verbatim,comment,eq,gather,align,figure,table,thebibliography,' + \. 'keywords,abstract,titlepage' + if !exists('g:Tex_FoldedEnvironments') + let g:Tex_FoldedEnvironments = s + elseif g:Tex_FoldedEnvironments[0] == ',' + let g:Tex_FoldedEnvironments = s . g:Tex_FoldedEnvironments + elseif g:Tex_FoldedEnvironments =~ ',$' + let g:Tex_FoldedEnvironments = g:Tex_FoldedEnvironments . s + endif + + if !exists('g:Tex_FoldedSections') + let g:Tex_FoldedSections = 'part,chapter,section,' + \. 'subsection,subsubsection,paragraph' + endif + + " the order in which these calls are made decides the nestedness. in + " latex, a table environment will always be embedded in either an item or + " a section etc. not the other way around. so we first fold up all the + " tables. and then proceed with the other regions. + + let b:numFoldItems = 0 + + " ======================================================================== + " How to add new folding items {{{ + " ======================================================================== + " + " Each of the following function calls defines a syntax fold region. Each + " definition consists of a call to the AddSyntaxFoldItem() function. + " + " The order in which the folds are defined is important. Juggling the + " order of the function calls will create havoc with folding. The + " "deepest" folding item needs to be called first. For example, if + " the \begin{table} environment is a subset (or lies within) the \section + " environment, then add the definition for the \table first. + " + " The AddSyntaxFoldItem() function takes either 4 or 6 arguments. When it + " is called with 4 arguments, it is equivalent to calling it with 6 + " arguments with the last two left blank (i.e as empty strings) + " + " The explanation for each argument is as follows: + " startpat: a line matching this pattern defines the beginning of a fold. + " endpat : a line matching this pattern defines the end of a fold. + " startoff: this is the offset from the starting line at which folding will + " actually start + " endoff : like startoff, but gives the offset of the actual fold end from + " the line satisfying endpat. + " startoff and endoff are necessary when the folding region does + " not have a specific end pattern corresponding to a start + " pattern. for example in latex, + " \begin{section} + " defines the beginning of a section, but its not necessary to + " have a corresponding + " \end{section} + " the section is assumed to end 1 line _before_ another section + " starts. + " startskip: a pattern which defines the beginning of a "skipped" region. + " + " For example, suppose we define a \itemize fold as follows: + " startpat = '^\s*\\item', + " endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + " startoff = 0, + " endoff = -1 + " + " This defines a fold which starts with a line beginning with an + " \item and ending one line before a line beginning with an + " \item or \end{enumerate} etc. + " + " Then, as long as \item's are not nested things are fine. + " However, once items begin to nest, the fold started by one + " \item can end because of an \item in an \itemize + " environment within this \item. i.e, the following can happen: + " + " \begin{itemize} + " \item Some text <------- fold will start here + " This item will contain a nested item + " \begin{itemize} <----- fold will end here because next line contains \item... + " \item Hello + " \end{itemize} <----- ... instead of here. + " \item Next item of the parent itemize + " \end{itemize} + " + " Therefore, in order to completely define a folding item which + " allows nesting, we need to also define a "skip" pattern. + " startskip and end skip do that. + " Leave '' when there is no nesting. + " endskip: the pattern which defines the end of the "skip" pattern for + " nested folds. + " + " Example: + " 1. A syntax fold region for a latex section is + " startpat = "\\section{" + " endpat = "\\section{" + " startoff = 0 + " endoff = -1 + " startskip = '' + " endskip = '' + " Note that the start and end patterns are thus the same and endoff has a + " negative value to capture the effect of a section ending one line before + " the next starts. + " 2. A syntax fold region for the \itemize environment is: + " startpat = '^\s*\\item', + " endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + " startoff = 0, + " endoff = -1, + " startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', + " endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' + " Note the use of startskip and endskip to allow nesting. + " + " + " }}} + " ======================================================================== + + " {{{ comment lines + if g:Tex_FoldedMisc =~ '\<comments\>' + call AddSyntaxFoldItem ( + \ '^%\([^%]\|[^f]\|[^a]\|[^k]\|[^e]\)', + \ '^[^%]', + \ 0, + \ -1 + \ ) + endif + " }}} + + " {{{ items + if g:Tex_FoldedMisc =~ '\<item\>' + call AddSyntaxFoldItem ( + \ '^\s*\\item', + \ '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', + \ 0, + \ -1, + \ '^\s*\\begin{\(enumerate\|itemize\|description\)}', + \ '^\s*\\end{\(enumerate\|itemize\|description\)}' + \ ) + endif + " }}} + + " {{{ title + if g:Tex_FoldedMisc =~ '\<title\>' + call AddSyntaxFoldItem ( + \ '^\s*\\title\W', + \ '^\s*\\maketitle', + \ 0, + \ 0 + \ ) + endif + " }}} + + " Commands and Environments {{{ + " Fold the commands and environments in 2 passes. + let pass = 0 + while pass < 2 + if pass == 0 + let lst = g:Tex_FoldedCommands + else + let lst = g:Tex_FoldedEnvironments + endif + while lst != '' + let i = match(lst, ',') + if i > 0 + let s = strpart(lst, 0, i) + let lst = strpart(lst, i+1) + else + let s = lst + let lst = '' + endif + if s != '' + if pass == 0 + " NOTE: This pattern ensures that a command which is + " terminated on the same line will not start a fold. + " However, it will also refuse to fold certain commands + " which have not terminated. eg: + " \commandname{something \bf{text} and + " will _not_ start a fold. + " In other words, the pattern is safe, but not exact. + call AddSyntaxFoldItem('^\s*\\'.s.'{[^{}]*$','^[^}]*}',0,0) + else + call AddSyntaxFoldItem('^\s*\\begin{'.s,'\(^\|\s\)\s*\\end{'.s,0,0) + endif + endif + endwhile + let pass = pass + 1 + endwhile + " }}} + + " Sections {{{ + if g:Tex_FoldedSections != '' + call Tex_FoldSections(g:Tex_FoldedSections, + \ '^\s*\\frontmatter\|^\s*\\mainmatter\|^\s*\\backmatter\|' + \. '^\s*\\begin{thebibliography\|>>>\|^\s*\\endinput\|' + \. '^\s*\\begin{slide\|^\s*\\end{document') + endif + " }}} + + " {{{ slide + if g:Tex_FoldedMisc =~ '\<slide\>' + call AddSyntaxFoldItem ( + \ '^\s*\\begin{slide', + \ '^\s*\\appendix\W\|^\s*\\chapter\W\|^\s*\\end{slide\|^\s*\\end{document', + \ 0, + \ 0 + \ ) + endif + " }}} + + " {{{ preamble + if g:Tex_FoldedMisc =~ '\<preamble\>' + call AddSyntaxFoldItem ( + \ '^\s*\\document\(class\|style\).*{', + \ '^\s*\\begin{document}', + \ 0, + \ -1 + \ ) + endif + " }}} + + " Manually folded regions {{{ + if g:Tex_FoldedMisc =~ '\(^\|,\)<<<\(,\|$\)' + call AddSyntaxFoldItem ( + \ '<<<', + \ '>>>', + \ 0, + \ 0 + \ ) + endif + " }}} + + call MakeSyntaxFolds(a:force) + normal! zv +endfunction + +" }}} +" TexFoldTextFunction: create fold text for folds {{{ +function! TexFoldTextFunction() + let leadingSpace = matchstr(' ', ' \{,'.indent(v:foldstart).'}') + if getline(v:foldstart) =~ '^\s*\\begin{' + let header = matchstr(getline(v:foldstart), + \ '^\s*\\begin{\zs\([:alpha:]*\)[^}]*\ze}') + let caption = '' + let label = '' + let i = v:foldstart + while i <= v:foldend + if getline(i) =~ '\\caption' + " distinguish between + " \caption{fulldesc} - fulldesc will be displayed + " \caption[shortdesc]{fulldesc} - shortdesc will be displayed + if getline(i) =~ '\\caption\[' + let caption = matchstr(getline(i), '\\caption\[\zs[^\]]*') + let caption = substitute(caption, '\zs\]{.*}[^}]*$', '', '') + else + let caption = matchstr(getline(i), '\\caption{\zs.*') + let caption = substitute(caption, '\zs}[^}]*$', '', '') + end + elseif getline(i) =~ '\\label' + let label = matchstr(getline(i), '\\label{\zs.*') + " :FIXME: this does not work when \label contains a + " newline or a }-character + let label = substitute(label, '\([^}]*\)}.*$', '\1', '') + end + + let i = i + 1 + endwhile + + let ftxto = foldtext() + " if no caption found, then use the second line. + if caption == '' + let caption = getline(v:foldstart + 1) + end + + let retText = matchstr(ftxto, '^[^:]*').': '.header. + \ ' ('.label.'): '.caption + return leadingSpace.retText + + elseif getline(v:foldstart) =~ '^%' && getline(v:foldstart) !~ '^%%fake' + let ftxto = foldtext() + return leadingSpace.substitute(ftxto, ':', ': % ', '') + elseif getline(v:foldstart) =~ '^\s*\\document\(class\|style\).*{' + let ftxto = leadingSpace.foldtext() + return substitute(ftxto, ':', ': Preamble: ', '') + else + return leadingSpace.foldtext() + end +endfunction +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/macros/example b/vim-latex/ftplugin/latex-suite/macros/example new file mode 100644 index 0000000..395311f --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/macros/example @@ -0,0 +1,11 @@ +% my long complicated macro. This is an example of how to set up a +% tex-macro for latex-suite. simply type in the lines as you would in +% latex. Place holders are allowed. +% NOTE: if you have filetype indentation turned on, then do not do +% formatting here. the indentation will follow automatically... +\begin{mycomplicatedenvironment} +\mycommand1{<++>} +\mycommand2{<+hint2+>} +\mycommand3{<++>} +\mycommand4{<++>} +\end{mycomplicatedenvironment}<++> diff --git a/vim-latex/ftplugin/latex-suite/main.vim b/vim-latex/ftplugin/latex-suite/main.vim new file mode 100644 index 0000000..65588c9 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/main.vim @@ -0,0 +1,1041 @@ +" LaTeX filetype +" Language: LaTeX (ft=tex) +" Maintainer: Srinath Avadhanula +" URL: + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +" avoiding re-inclusion {{{ +" the avoiding re-inclusion statement is not provided here because the files +" which call this file should in the normal course of events handle the +" re-inclusion stuff. + +" we definitely dont want to run through the entire file each and every time. +" only once to define the functions. for successive latex files, just set up +" the folding and mappings and quit. +if exists('s:doneFunctionDefinitions') && !exists('b:forceRedoLocalTex') + call s:SetTeXOptions() + finish +endif + +let s:doneFunctionDefinitions = 1 + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +let s:path = expand('<sfile>:p:h') +" set up personal defaults. +runtime ftplugin/tex/texrc +" set up global defaults. +exe "so ".fnameescape(s:path.'/texrc') + +" }}} + +nmap <silent> <script> <plug> i +imap <silent> <script> <C-o><plug> <Nop> + +" ============================================================================== +" mappings +" ============================================================================== +" {{{ +" calculate the mapleader character. +let s:ml = '<Leader>' + +if !exists('s:doneMappings') + let s:doneMappings = 1 + " short forms for latex formatting and math elements. {{{ + " taken from auctex.vim or miktexmacros.vim + call IMAP ('__', '_{<++>}<++>', "tex") + call IMAP ('()', '(<++>)<++>', "tex") + call IMAP ('[]', '[<++>]<++>', "tex") + call IMAP ('{}', '{<++>}<++>', "tex") + call IMAP ('^^', '^{<++>}<++>', "tex") + call IMAP ('$$', '$<++>$<++>', "tex") + call IMAP ('==', '&=& ', "tex") + call IMAP ('~~', '&\approx& ', "tex") + call IMAP ('=~', '\approx', "tex") + call IMAP ('::', '\dots', "tex") + call IMAP ('((', '\left( <++> \right)<++>', "tex") + call IMAP ('[[', '\left[ <++> \right]<++>', "tex") + call IMAP ('{{', '\left\{ <++> \right\}<++>', "tex") + call IMAP (g:Tex_Leader.'^', '\hat{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'_', '\bar{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'6', '\partial', "tex") + call IMAP (g:Tex_Leader.'8', '\infty', "tex") + call IMAP (g:Tex_Leader.'/', '\frac{<++>}{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'%', '\frac{<++>}{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'@', '\circ', "tex") + call IMAP (g:Tex_Leader.'0', '^\circ', "tex") + call IMAP (g:Tex_Leader.'=', '\equiv', "tex") + call IMAP (g:Tex_Leader."\\",'\setminus', "tex") + call IMAP (g:Tex_Leader.'.', '\cdot', "tex") + call IMAP (g:Tex_Leader.'*', '\times', "tex") + call IMAP (g:Tex_Leader.'&', '\wedge', "tex") + call IMAP (g:Tex_Leader.'-', '\bigcap', "tex") + call IMAP (g:Tex_Leader.'+', '\bigcup', "tex") + call IMAP (g:Tex_Leader.'M', '\sum_{<++>}^{<++>}<++>', 'tex') + call IMAP (g:Tex_Leader.'S', '\sum_{<++>}^{<++>}<++>', 'tex') + call IMAP (g:Tex_Leader.'(', '\subset', "tex") + call IMAP (g:Tex_Leader.')', '\supset', "tex") + call IMAP (g:Tex_Leader.'<', '\le', "tex") + call IMAP (g:Tex_Leader.'>', '\ge', "tex") + call IMAP (g:Tex_Leader.',', '\nonumber', "tex") + call IMAP (g:Tex_Leader.'~', '\tilde{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.';', '\dot{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.':', '\ddot{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'2', '\sqrt{<++>}<++>', "tex") + call IMAP (g:Tex_Leader.'|', '\Big|', "tex") + call IMAP (g:Tex_Leader.'I', "\\int_{<++>}^{<++>}<++>", 'tex') + " }}} + " Greek Letters {{{ + call IMAP(g:Tex_Leader.'a', '\alpha', 'tex') + call IMAP(g:Tex_Leader.'b', '\beta', 'tex') + call IMAP(g:Tex_Leader.'c', '\chi', 'tex') + call IMAP(g:Tex_Leader.'d', '\delta', 'tex') + call IMAP(g:Tex_Leader.'e', '\varepsilon', 'tex') + call IMAP(g:Tex_Leader.'f', '\varphi', 'tex') + call IMAP(g:Tex_Leader.'g', '\gamma', 'tex') + call IMAP(g:Tex_Leader.'h', '\eta', 'tex') + call IMAP(g:Tex_Leader.'k', '\kappa', 'tex') + call IMAP(g:Tex_Leader.'l', '\lambda', 'tex') + call IMAP(g:Tex_Leader.'m', '\mu', 'tex') + call IMAP(g:Tex_Leader.'n', '\nu', 'tex') + call IMAP(g:Tex_Leader.'p', '\pi', 'tex') + call IMAP(g:Tex_Leader.'q', '\theta', 'tex') + call IMAP(g:Tex_Leader.'r', '\rho', 'tex') + call IMAP(g:Tex_Leader.'s', '\sigma', 'tex') + call IMAP(g:Tex_Leader.'t', '\tau', 'tex') + call IMAP(g:Tex_Leader.'u', '\upsilon', 'tex') + call IMAP(g:Tex_Leader.'v', '\varsigma', 'tex') + call IMAP(g:Tex_Leader.'w', '\omega', 'tex') + call IMAP(g:Tex_Leader.'w', '\wedge', 'tex') " AUCTEX style + call IMAP(g:Tex_Leader.'x', '\xi', 'tex') + call IMAP(g:Tex_Leader.'y', '\psi', 'tex') + call IMAP(g:Tex_Leader.'z', '\zeta', 'tex') + " not all capital greek letters exist in LaTeX! + " reference: http://www.giss.nasa.gov/latex/ltx-405.html + call IMAP(g:Tex_Leader.'D', '\Delta', 'tex') + call IMAP(g:Tex_Leader.'F', '\Phi', 'tex') + call IMAP(g:Tex_Leader.'G', '\Gamma', 'tex') + call IMAP(g:Tex_Leader.'Q', '\Theta', 'tex') + call IMAP(g:Tex_Leader.'L', '\Lambda', 'tex') + call IMAP(g:Tex_Leader.'X', '\Xi', 'tex') + call IMAP(g:Tex_Leader.'Y', '\Psi', 'tex') + call IMAP(g:Tex_Leader.'S', '\Sigma', 'tex') + call IMAP(g:Tex_Leader.'U', '\Upsilon', 'tex') + call IMAP(g:Tex_Leader.'W', '\Omega', 'tex') + " }}} + " ProtectLetters: sets up indentity maps for things like ``a {{{ + " " Description: If we simply do + " call IMAP('`a', '\alpha', 'tex') + " then we will never be able to type 'a' after a tex-quotation. Since + " IMAP() always uses the longest map ending in the letter, this problem + " can be avoided by creating a fake map for ``a -> ``a. + " This function sets up fake maps of the following forms: + " ``[aA] -> ``[aA] (for writing in quotations) + " \`[aA] -> \`[aA] (for writing diacritics) + " "`[aA] -> "`[aA] (for writing german quotations) + " It does this for all printable lower ascii characters just to make sure + " we dont let anything slip by. + function! s:ProtectLetters(first, last) + let i = a:first + while i <= a:last + if nr2char(i) =~ '[[:print:]]' + call IMAP('``'.nr2char(i), '``'.nr2char(i), 'tex') + call IMAP('\`'.nr2char(i), '\`'.nr2char(i), 'tex') + call IMAP('"`'.nr2char(i), '"`'.nr2char(i), 'tex') + endif + let i = i + 1 + endwhile + endfunction + call s:ProtectLetters(32, 127) + " }}} + " vmaps: enclose selected region in brackets, environments {{{ + " The action changes depending on whether the selection is character-wise + " or line wise. for example, selecting linewise and pressing \v will + " result in the region being enclosed in \begin{verbatim}, \end{verbatim}, + " whereas in characterise visual mode, the thingie is enclosed in \verb| + " and |. + exec 'vnoremap <silent> '.g:Tex_Leader."( \<C-\\>\<C-N>:call VEnclose('\\left( ', ' \\right)', '\\left(', '\\right)')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."[ \<C-\\>\<C-N>:call VEnclose('\\left[ ', ' \\right]', '\\left[', '\\right]')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."{ \<C-\\>\<C-N>:call VEnclose('\\left\\{ ', ' \\right\\}', '\\left\\{', '\\right\\}')\<CR>" + exec 'vnoremap <silent> '.g:Tex_Leader."$ \<C-\\>\<C-N>:call VEnclose('$', '$', '\\[', '\\]')\<CR>" + " }}} +end + +" }}} + +" ============================================================================== +" Helper functions for debugging +" ============================================================================== +" Tex_Debug: appends the argument into s:debugString {{{ +" Description: +" +" Do not want a memory leak! Set this to zero so that latex-suite always +" starts out in a non-debugging mode. +if !exists('g:Tex_Debug') + let g:Tex_Debug = 0 +endif +function! Tex_Debug(str, ...) + if !g:Tex_Debug + return + endif + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if !exists('s:debugString_'.pattern) + let s:debugString_{pattern} = '' + endif + let s:debugString_{pattern} = s:debugString_{pattern}.a:str."\n" + + let s:debugString_ = (exists('s:debugString_') ? s:debugString_ : '') + \ . pattern.' : '.a:str."\n" + + if Tex_GetVarValue('Tex_DebugLog') != '' + exec 'redir! >> '.Tex_GetVarValue('Tex_DebugLog') + silent! echo pattern.' : '.a:str + redir END + endif +endfunction " }}} +" Tex_PrintDebug: prings s:debugString {{{ +" Description: +" +function! Tex_PrintDebug(...) + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if exists('s:debugString_'.pattern) + echo s:debugString_{pattern} + endif +endfunction " }}} +" Tex_ClearDebug: clears the s:debugString string {{{ +" Description: +" +function! Tex_ClearDebug(...) + if a:0 > 0 + let pattern = a:1 + else + let pattern = '' + endif + if exists('s:debugString_'.pattern) + let s:debugString_{pattern} = '' + endif +endfunction " }}} +" Tex_ShowVariableValue: debugging help {{{ +" provides a way to examine script local variables from outside the script. +" very handy for debugging. +function! Tex_ShowVariableValue(...) + let i = 1 + while i <= a:0 + exe 'let arg = a:'.i + if exists('s:'.arg) || + \ exists('*s:'.arg) + exe 'let val = s:'.arg + echomsg 's:'.arg.' = '.val + end + let i = i + 1 + endwhile +endfunction + +" }}} + +" ============================================================================== +" Helper functions for grepping +" ============================================================================== +" Tex_Grep: shorthand for :grep or :vimgrep {{{ +function! Tex_Grep(string, where) + if v:version >= 700 + exec 'silent! vimgrep! /'.a:string.'/ '.a:where + else + exec 'silent! grep! '.Tex_EscapeForGrep(a:string).' '.a:where + endif +endfunction + +" }}} +" Tex_Grepadd: shorthand for :grepadd or :vimgrepadd {{{ +function! Tex_Grepadd(string, where) + if v:version >= 700 + exec 'silent! vimgrepadd! /'.a:string.'/ '.a:where + else + exec "silent! grepadd! ".Tex_EscapeForGrep(a:string).' '.a:where + endif +endfunction + +" }}} +" Tex_EscapeForGrep: escapes back-slashes and doublequotes the correct number of times {{{ +" Description: This command escapes the backslash and double quotes in a +" search pattern the correct number of times so it can be used in the ``:grep`` +" command. This command is meant to be used as:: +" +" exec "silent! grep ".Tex_EscapeForGrep(pattern)." file" +" +" The input argument to this function should be the string which you want +" the external command to finally see. For example, to search for a string +" ``'\bibitem'``, the grep command needs to be passed a string like +" ``'\\bibitem'``. Examples:: +" +" Tex_EscapeForGrep('\\bibitem') " correct +" Tex_EscapeForGrep('\bibitem') " wrong +" Tex_EscapeForGrep("\\bibitem") " wrong +" Tex_EscapeForGrep('\<word\>') " correct +" +function! Tex_EscapeForGrep(string) + let retVal = a:string + + " The shell halves the backslashes. + if &shell =~ 'sh' + let retVal = escape(retVal, "\\") + + " If shellxquote is set, then the backslashes are halved yet again. + if &shellxquote == '"' + let retVal = escape(retVal, "\"\\") + endif + + endif + " escape special characters which bash/cmd.exe might interpret + let retVal = escape(retVal, "<>") + + return retVal +endfunction " }}} + +" ============================================================================== +" Uncategorized helper functions +" ============================================================================== +" Tex_Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! Tex_Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" Tex_CreatePrompt: creates a prompt string {{{ +" Description: +" Arguments: +" promptList: This is a string of the form: +" 'item1,item2,item3,item4' +" cols: the number of columns in the resultant prompt +" sep: the list seperator token +" +" Example: +" Tex_CreatePrompt('item1,item2,item3,item4', 2, ',') +" returns +" "(1) item1\t(2)item2\n(3)item3\t(4)item4" +" +" This string can be used in the input() function. +function! Tex_CreatePrompt(promptList, cols, sep) + + let g:listSep = a:sep + let num_common = GetListCount(a:promptList) + + let i = 1 + let promptStr = "" + + while i <= num_common + + let j = 0 + while j < a:cols && i + j <= num_common + let com = Tex_Strntok(a:promptList, a:sep, i+j) + let promptStr = promptStr.'('.(i+j).') '. + \ com."\t".( strlen(com) < 4 ? "\t" : '' ) + + let j = j + 1 + endwhile + + let promptStr = promptStr."\n" + + let i = i + a:cols + endwhile + return promptStr +endfunction + +" }}} +" Tex_CleanSearchHistory: removes last search item from search history {{{ +" Description: This function needs to be globally visible because its +" called from outside the script during expansion. +function! Tex_CleanSearchHistory() + call histdel("/", -1) + let @/ = histget("/", -1) +endfunction +nmap <silent> <script> <plug>cleanHistory :call Tex_CleanSearchHistory()<CR> + +" }}} +" Tex_GetVarValue: gets the value of the variable {{{ +" Description: +" See if a window-local, buffer-local or global variable with the given name +" exists and if so, returns the corresponding value. If none exist, return +" an empty string. +function! Tex_GetVarValue(varname, ...) + if exists('w:'.a:varname) + return w:{a:varname} + elseif exists('b:'.a:varname) + return b:{a:varname} + elseif exists('g:'.a:varname) + return g:{a:varname} + elseif a:0 > 0 + return a:1 + else + return '' + endif +endfunction " }}} +" Tex_GetMainFileName: gets the name of the main file being compiled. {{{ +" Description: returns the full path name of the main file. +" This function checks for the existence of a .latexmain file +" which might point to the location of a "main" latex file. +" If .latexmain exists, then return the full path name of the +" file being pointed to by it. +" +" Otherwise, return the full path name of the current buffer. +" +" You can supply an optional "modifier" argument to the +" function, which will optionally modify the file name before +" returning. +" NOTE: From version 1.6 onwards, this function always trims +" away the .latexmain part of the file name before applying the +" modifier argument. +function! Tex_GetMainFileName(...) + if a:0 > 0 + let modifier = a:1 + else + let modifier = ':p' + endif + + " If the user wants to use his own way to specify the main file name, then + " use it straight away. + if Tex_GetVarValue('Tex_MainFileExpression') != '' + exec 'let retval = '.Tex_GetVarValue('Tex_MainFileExpression') + return retval + endif + + let s:origdir = fnameescape(getcwd()) + + let dirmodifier = '%:p:h' + let dirLast = fnameescape(expand(dirmodifier)) + exe 'cd '.dirLast + + " move up the directory tree until we find a .latexmain file. + " TODO: Should we be doing this recursion by default, or should there be a + " setting? + while glob('*.latexmain') == '' + let dirmodifier = dirmodifier.':h' + let dirNew = fnameescape(expand(dirmodifier)) + " break from the loop if we cannot go up any further. + if dirNew == dirLast + break + endif + let dirLast = dirNew + exe 'cd '.dirLast + endwhile + + let lheadfile = glob('*.latexmain') + if lheadfile != '' + " Remove the trailing .latexmain part of the filename... We never want + " that. + let lheadfile = fnamemodify(substitute(lheadfile, '\.latexmain$', '', ''), modifier) + else + " If we cannot find any main file, just modify the filename of the + " current buffer. + let lheadfile = expand('%'.modifier) + endif + + exe 'cd '.s:origdir + + " NOTE: The caller of this function needs to escape the file name with + " fnameescape() . The reason its not done here is that escaping is not + " safe if this file is to be used as part of an external command on + " certain platforms. + return lheadfile +endfunction + +" }}} +" Tex_ChooseFromPrompt: process a user input to a prompt string {{{ +" " Description: +function! Tex_ChooseFromPrompt(dialog, list, sep) + let g:Tex_ASDF = a:dialog + let inp = input(a:dialog) + if inp =~ '\d\+' + return Tex_Strntok(a:list, a:sep, inp) + else + return inp + endif +endfunction " }}} +" Tex_ChooseFile: produces a file list and prompts for choice {{{ +" Description: +function! Tex_ChooseFile(dialog) + let files = glob('*') + if files == '' + return '' + endif + let s:incnum = 0 + echo a:dialog + let filenames = substitute(files, "\\v(^|\n)", "\\=submatch(0).Tex_IncrementNumber(1).' : '", 'g') + echo filenames + let choice = input('Enter Choice : ') + let g:choice = choice + if choice == '' + return '' + endif + if choice =~ '^\s*\d\+\s*$' + let retval = Tex_Strntok(files, "\n", choice) + else + let filescomma = substitute(files, "\n", ",", "g") + let retval = GetListMatchItem(filescomma, choice) + endif + if retval == '' + return '' + endif + return retval +endfunction + +" }}} +" Tex_IncrementNumber: returns an incremented number each time {{{ +" Description: +let s:incnum = 0 +function! Tex_IncrementNumber(increm) + let s:incnum = s:incnum + a:increm + return s:incnum +endfunction + +" }}} +" Tex_ResetIncrementNumber: increments s:incnum to zero {{{ +" Description: +function! Tex_ResetIncrementNumber(val) + let s:incnum = a:val +endfunction " }}} +" Tex_FindInRtp: check if file exists in &rtp {{{ +" Description: Checks if file exists in globpath(&rtp, ...) and cuts off the +" rest of returned names. This guarantees that sourced file is +" from $HOME. +" If an optional argument is given, it specifies how to expand +" each filename found. For example, '%:p' will return a list of +" the complete paths to the files. By default returns trailing +" path-names without extenions. +" NOTE: This function is very slow when a large number of +" matches are found because of a while loop which modifies +" each filename found. Some speedup was acheived by using +" a tokenizer approach rather than using Tex_Strntok which +" would have been more obvious. +function! Tex_FindInRtp(filename, directory, ...) + " how to expand each filename. ':p:t:r' modifies each filename to its + " trailing part without extension. + let expand = (a:0 > 0 ? a:1 : ':p:t:r') + " The pattern used... An empty filename should be regarded as '*' + let pattern = (a:filename != '' ? a:filename : '*') + + let filelist = globpath(&rtp, 'ftplugin/latex-suite/'.a:directory.'/'.pattern)."\n" + + if filelist == "\n" + return '' + endif + + if a:filename != '' + return fnamemodify(Tex_Strntok(filelist, "\n", 1), expand) + endif + + " Now cycle through the files modifying each filename in the desired + " manner. + let retfilelist = '' + let i = 1 + while 1 + " Extract the portion till the next newline. Then shorten the filelist + " by removing till the newline. + let nextnewline = stridx(filelist, "\n") + if nextnewline == -1 + break + endif + let filename = strpart(filelist, 0, nextnewline) + let filelist = strpart(filelist, nextnewline+1) + + " The actual modification. + if fnamemodify(filename, expand) != '' + let retfilelist = retfilelist.fnamemodify(filename, expand)."," + endif + let i = i + 1 + endwhile + + return substitute(retfilelist, ',$', '', '') +endfunction + +" }}} +" Tex_GetErrorList: returns vim's clist {{{ +" Description: returns the contents of the error list available via the :clist +" command. +function! Tex_GetErrorList() + let _a = @a + redir @a | silent! clist | redir END + let errlist = @a + let @a = _a + + if errlist =~ 'E42: ' + let errlist = '' + endif + + return errlist +endfunction " }}} +" Tex_GetTempName: get the name of a temporary file in specified directory {{{ +" Description: Unlike vim's native tempname(), this function returns the name +" of a temporary file in the directory specified. This enables +" us to create temporary files in a specified directory. +function! Tex_GetTempName(dirname) + let prefix = 'latexSuiteTemp' + let slash = (a:dirname =~ '\\\|/$' ? '' : '/') + let i = 0 + while filereadable(a:dirname.slash.prefix.i.'.tex') && i < 1000 + let i = i + 1 + endwhile + if filereadable(a:dirname.slash.prefix.i.'.tex') + echoerr "Temporary file could not be created in ".a:dirname + return '' + endif + return expand(a:dirname.slash.prefix.i.'.tex', ':p') +endfunction +" }}} +" Tex_MakeMap: creates a mapping from lhs to rhs if rhs is not already mapped {{{ +" Description: +function! Tex_MakeMap(lhs, rhs, mode, extraargs) + if !hasmapto(a:rhs, a:mode) + exec a:mode.'map '.a:extraargs.' '.a:lhs.' '.a:rhs + endif +endfunction " }}} +" Tex_CD: cds to given directory escaping spaces if necessary {{{ +" " Description: +function! Tex_CD(dirname) + exec 'cd '.Tex_EscapeSpaces(a:dirname) +endfunction " }}} +" Tex_EscapeSpaces: escapes unescaped spaces from a path name {{{ +" Description: +function! Tex_EscapeSpaces(path) + return substitute(a:path, '[^\\]\(\\\\\)*\zs ', '\\ ', 'g') +endfunction " }}} +" Tex_FindFile: finds a file in the vim's 'path' {{{ +" Description: finds a file in vim's 'path' +function! Tex_FindFile(fname, path, suffixesadd) + if exists('*findfile') + let _suffixesadd = &suffixesadd + let &suffixesadd = a:suffixesadd + let retval = findfile(a:fname, a:path) + let &suffixesadd = _suffixesadd + else + " split a new window so we do not screw with the current buffer. We + " want to use the same filename each time so that multiple scratch + " buffers are not created. + let retval = '' + silent! split __HOPEFULLY_THIS_FILE_DOES_NOT_EXIST__ + let _suffixesadd = &suffixesadd + let _path = &path + let &suffixesadd = a:suffixesadd + let &path = a:path + exec 'silent! find '.a:fname + if bufname('%') != '__HOPEFULLY_THIS_FILE_DOES_NOT_EXIST__' + let retval = expand('%:p') + end + silent! bdelete! + let &suffixesadd = _suffixesadd + let &path = _path + endif + return retval +endfunction " }}} +" Tex_GetPos: gets position of cursor {{{ +function! Tex_GetPos() + if exists('*getpos') + return getpos('.') + else + return line('.').' | normal! '.virtcol('.').'|' + endif +endfunction " }}} +" Tex_SetPos: sets position of cursor {{{ +function! Tex_SetPos(pos) + if exists('*setpos') + call setpos('.', a:pos) + else + exec a:pos + endif +endfunction " }}} + + +" ============================================================================== +" Smart key-mappings +" ============================================================================== +" TexQuotes: inserts `` or '' instead of " {{{ +if g:Tex_SmartKeyQuote + + " TexQuotes: inserts `` or '' instead of " + " Taken from texmacro.vim by Benji Fisher <benji@e-math.AMS.org> + " TODO: Deal with nested quotes. + " The :imap that calls this function should insert a ", move the cursor to + " the left of that character, then call this with <C-R>= . + function! s:TexQuotes() + let l = line(".") + let c = col(".") + let restore_cursor = l . "G" . virtcol(".") . "|" + normal! H + let restore_cursor = "normal!" . line(".") . "Gzt" . restore_cursor + execute restore_cursor + " In math mode, or when preceded by a \, just move the cursor past the + " already-inserted " character. + if synIDattr(synID(l, c, 1), "name") =~ "^texMath" + \ || (c > 1 && getline(l)[c-2] == '\') + return "\<Right>" + endif + " Find the appropriate open-quote and close-quote strings. + if exists("b:Tex_SmartQuoteOpen") + let open = b:Tex_SmartQuoteOpen + elseif exists("g:Tex_SmartQuoteOpen") + let open = g:Tex_SmartQuoteOpen + else + let open = "``" + endif + if exists("b:Tex_SmartQuoteClose") + let close = b:Tex_SmartQuoteClose + elseif exists("g:Tex_SmartQuoteClose") + let close = g:Tex_SmartQuoteClose + else + let close = "''" + endif + let boundary = '\|' + " This code seems to be obsolete, since this script variable is never + " set. The idea is that some languages use ",," as an open- or + " close-quote string, and we want to avoid confusing ordinary "," + " with a quote boundary. + if exists("s:TeX_strictquote") + if( s:TeX_strictquote == "open" || s:TeX_strictquote == "both" ) + let boundary = '\<' . boundary + endif + if( s:TeX_strictquote == "close" || s:TeX_strictquote == "both" ) + let boundary = boundary . '\>' + endif + endif + + " Eventually return q; set it to the default value now. + let q = open + let pattern = + \ escape(open, '\~') . + \ boundary . + \ escape(close, '\~') . + \ '\|^$\|"' + + while 1 " Look for preceding quote (open or close), ignoring + " math mode and '\"' . + call search(pattern, "bw") + if synIDattr(synID(line("."), col("."), 1), "name") !~ "^texMath" + \ && strpart(getline('.'), col('.')-2, 2) != '\"' + break + endif + endwhile + + " Now, test whether we actually found a _preceding_ quote; if so, is it + " an open quote? + if ( line(".") < l || line(".") == l && col(".") < c ) + if strpart(getline("."), col(".")-1) =~ '\V\^' . escape(open, '\') + if line(".") == l && col(".") + strlen(open) == c + " Insert "<++>''<++>" instead of just "''". + let q = IMAP_PutTextWithMovement("<++>".close."<++>") + else + let q = close + endif + endif + endif + + " Return to line l, column c: + execute restore_cursor + " Start with <Del> to remove the " put in by the :imap . + return "\<Del>" . q + + endfunction + +endif +" }}} +" SmartBS: smart backspacing {{{ +if g:Tex_SmartKeyBS + + " SmartBS: smart backspacing + " SmartBS lets you treat diacritic characters (those \'{a} thingies) as a + " single character. This is useful for example in the following situation: + " + " \v{s}\v{t}astn\'{y} ('happy' in Slovak language :-) ) + " If you will delete this normally (without using smartBS() function), you + " must press <BS> about 19x. With function smartBS() you must press <BS> only + " 7x. Strings like "\v{s}", "\'{y}" are considered like one character and are + " deleted with one <BS>. + let s:smartBS_pat = Tex_GetVarValue('Tex_SmartBSPattern') + + fun! s:SmartBS_pat() + return s:smartBS_pat + endfun + + " This function comes from Benji Fisher <benji@e-math.AMS.org> + " http://vim.sourceforge.net/scripts/download.php?src_id=409 + " (modified/patched by Lubomir Host 'rajo' <host8 AT keplerDOTfmphDOTuniba.sk>) + function! s:SmartBS(pat) + let init = strpart(getline("."), 0, col(".")-1) + let matchtxt = matchstr(init, a:pat) + if matchtxt != '' + let bstxt = substitute(matchtxt, '.', "\<bs>", 'g') + return bstxt + else + return "\<bs>" + endif + endfun + +endif " }}} +" SmartDots: inserts \cdots instead of ... in math mode otherwise \ldots {{{ +" if amsmath package is detected then just use \dots and let amsmath take care +" of it. +if g:Tex_SmartKeyDot + + function! <SID>SmartDots() + if strpart(getline('.'), col('.')-3, 2) == '..' && + \ g:Tex_package_detected =~ '\<amsmath\|ellipsis\>' + return "\<bs>\<bs>\\dots" + elseif synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath' + \&& strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\cdots" + elseif strpart(getline('.'), col('.')-3, 2) == '..' + return "\<bs>\<bs>\\ldots" + else + return '.' + endif + endfunction + +endif +" }}} + +" source texproject.vim before other files +exe 'source '.fnameescape(s:path.'/texproject.vim') + +" source all the relevant files. +exe 'source '.fnameescape(s:path.'/texmenuconf.vim') +exe 'source '.fnameescape(s:path.'/envmacros.vim') +exe 'source '.fnameescape(s:path.'/elementmacros.vim') + +" source utf-8 or plain math menus +if exists("g:Tex_UseUtfMenus") && g:Tex_UseUtfMenus != 0 && has("gui_running") + exe 'source '.fnameescape(s:path.'/mathmacros-utf.vim') +else + exe 'source '.fnameescape(s:path.'/mathmacros.vim') +endif + +exe 'source '.fnameescape(s:path.'/multicompile.vim') +exe 'source '.fnameescape(s:path.'/compiler.vim') +exe 'source '.fnameescape(s:path.'/folding.vim') +exe 'source '.fnameescape(s:path.'/templates.vim') +exe 'source '.fnameescape(s:path.'/custommacros.vim') +exe 'source '.fnameescape(s:path.'/bibtex.vim') + +" source advanced math functions +if g:Tex_AdvancedMath == 1 + exe 'source '.fnameescape(s:path.'/brackets.vim') + exe 'source '.fnameescape(s:path.'/smartspace.vim') +endif + +if g:Tex_Diacritics != 0 + exe 'source '.fnameescape(s:path.'/diacritics.vim') +endif + +exe 'source '.fnameescape(s:path.'/texviewer.vim') +exe 'source '.fnameescape(s:path.'/version.vim') + +" ============================================================================== +" Finally set up the folding, options, mappings and quit. +" ============================================================================== +" SetTeXOptions: sets options/mappings for this file. {{{ +function! <SID>SetTeXOptions() + " Avoid reinclusion. + if exists('b:doneSetTeXOptions') + return + endif + let b:doneSetTeXOptions = 1 + + exe 'setlocal dict^='.fnameescape(s:path.'/dictionaries/dictionary') + + call Tex_Debug('SetTeXOptions: sourcing maps', 'main') + " smart functions + if g:Tex_SmartKeyQuote + inoremap <buffer> <silent> " "<Left><C-R>=<SID>TexQuotes()<CR> + endif + if g:Tex_SmartKeyBS + inoremap <buffer> <silent> <BS> <C-R>=<SID>SmartBS(<SID>SmartBS_pat())<CR> + endif + if g:Tex_SmartKeyDot + inoremap <buffer> <silent> . <C-R>=<SID>SmartDots()<CR> + endif + + " This line seems to be necessary to source our compiler/tex.vim file. + " The docs are unclear why this needs to be done even though this file is + " the first compiler plugin in 'runtimepath'. + runtime compiler/tex.vim + +endfunction + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('main.vim: Catching LatexSuiteFileType event', 'main') | + \ call <SID>SetTeXOptions() +augroup END + +" }}} + +" ============================================================================== +" Settings for taglist.vim plugin +" ============================================================================== +" Sets Tlist_Ctags_Cmd for taglist.vim and regexps for ctags {{{ +if exists("g:Tex_TaglistSupport") && g:Tex_TaglistSupport == 1 + if !exists("g:tlist_tex_settings") + let g:tlist_tex_settings = 'tex;s:section;c:chapter;l:label;r:ref' + endif + + if exists("Tlist_Ctags_Cmd") + let s:tex_ctags = Tlist_Ctags_Cmd + else + let s:tex_ctags = 'ctags' " Configurable in texrc? + endif + + if exists("g:Tex_InternalTagsDefinitions") && g:Tex_InternalTagsDefinitions == 1 + let Tlist_Ctags_Cmd = s:tex_ctags ." --langdef=tex --langmap=tex:.tex.ltx.latex" + \.' --regex-tex="/\\\\begin{abstract}/Abstract/s,abstract/"' + \.' --regex-tex="/\\\\part[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,part/"' + \.' --regex-tex="/\\\\chapter[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,chapter/"' + \.' --regex-tex="/\\\\section[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,section/"' + \.' --regex-tex="/\\\\subsection[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subsection/"' + \.' --regex-tex="/\\\\subsubsection[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subsubsection/"' + \.' --regex-tex="/\\\\paragraph[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,paragraph/"' + \.' --regex-tex="/\\\\subparagraph[ \t]*\*?\{[ \t]*([^}]*)\}/+ \1/s,subparagraph/"' + \.' --regex-tex="/\\\\begin{thebibliography}/BIBLIOGRAPHY/s,thebibliography/"' + \.' --regex-tex="/\\\\tableofcontents/TABLE OF CONTENTS/s,tableofcontents/"' + \.' --regex-tex="/\\\\frontmatter/FRONTMATTER/s,frontmatter/"' + \.' --regex-tex="/\\\\mainmatter/MAINMATTER/s,mainmatter/"' + \.' --regex-tex="/\\\\backmatter/BACKMATTER/s,backmatter/"' + \.' --regex-tex="/\\\\appendix/APPENDIX/s,appendix/"' + \.' --regex-tex="/\\\\label[ \t]*\*?\{[ \t]*([^}]*)\}/\1/l,label/"' + \.' --regex-tex="/\\\\ref[ \t]*\*?\{[ \t]*([^}]*)\}/\1/r,ref/"' + endif +endif + +" }}} + +" commands to completion +let g:Tex_completion_explorer = ',' + +" Mappings defined in package files will overwrite all other +exe 'source '.fnameescape(s:path.'/packages.vim') + +" ============================================================================== +" These functions are used to immitate certain operating system type functions +" (like reading the contents of a file), which are not available in vim. For +" example, in Vim, its not possible to read the contents of a file without +" opening a buffer on it, which means that over time, lots of buffers can open +" up needlessly. +" +" If python is available (and allowed), then these functions utilize python +" library functions without making calls to external programs. +" ============================================================================== +" Tex_GotoTempFile: open a temp file. reuse from next time on {{{ +function! Tex_GotoTempFile() + if !exists('s:tempFileName') + let s:tempFileName = tempname() + endif + exec 'silent! split '.s:tempFileName +endfunction " }}} +" Tex_IsPresentInFile: finds if a string str, is present in filename {{{ +if has('python') && g:Tex_UsePython + function! Tex_IsPresentInFile(regexp, filename) + exec 'python isPresentInFile(r"'.a:regexp.'", r"'.a:filename.'")' + + return retval + endfunction +else + function! Tex_IsPresentInFile(regexp, filename) + call Tex_GotoTempFile() + + silent! 1,$ d _ + let _report = &report + let _sc = &sc + set report=9999999 nosc + exec 'silent! 0r! '.g:Tex_CatCmd.' '.a:filename + set nomod + let &report = _report + let &sc = _sc + + if search(a:regexp, 'w') + let retval = 1 + else + let retval = 0 + endif + silent! bd + return retval + endfunction +endif " }}} +" Tex_CatFile: returns the contents of a file in a <NL> seperated string {{{ +if has('*readfile') + function! Tex_CatFile(filename) + return join(readfile(filename), "\n") + endfunction +elseif has('python') && g:Tex_UsePython + function! Tex_CatFile(filename) + " catFile assigns a value to retval + exec 'python catFile("'.a:filename.'")' + + return retval + endfunction +else + function! Tex_CatFile(filename) + if glob(a:filename) == '' + return '' + endif + + call Tex_GotoTempFile() + + silent! 1,$ d _ + + let _report = &report + let _sc = &sc + set report=9999999 nosc + exec 'silent! 0r! '.g:Tex_CatCmd.' '.a:filename + + set nomod + let _a = @a + silent! normal! ggVG"ay + let retval = @a + let @a = _a + + silent! bd + let &report = _report + let &sc = _sc + return retval + endfunction +endif +" }}} +" Tex_DeleteFile: removes a file if present {{{ +" Description: +if has('python') && g:Tex_UsePython + function! Tex_DeleteFile(filename) + exec 'python deleteFile(r"'.a:filename.'")' + + if exists('retval') + return retval + endif + endfunction +else + function! Tex_DeleteFile(filename) + if filereadable(a:filename) + exec '! '.g:Tex_RmCmd.' '.a:filename + endif + endfunction +endif +" }}} + + +let &cpo = s:save_cpo + +" Define the functions in python if available. +if !has('python') || !g:Tex_UsePython + finish +endif + +exec 'pyfile '.fnameescape(expand('<sfile>:p:h')).'/pytools.py' + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vim-latex/ftplugin/latex-suite/mathmacros-utf.vim b/vim-latex/ftplugin/latex-suite/mathmacros-utf.vim new file mode 100644 index 0000000..ac9cf7e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/mathmacros-utf.vim @@ -0,0 +1,729 @@ +"============================================================================= +" File: mathmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for everything mathematical in latex. +"============================================================================= + +if !(has('gui_running') && g:Tex_MathMenus && g:Tex_Menus) + finish +endif + +let s:MathMenuName = g:Tex_MenuPrefix.'Ma&th.' + +function! Tex_MathMenuRemove() + exe 'silent! aunmenu '.s:MathMenuName +endfunction + +let s:pA = 'amenu <silent> 85 '.s:MathMenuName + +" brackets and dollars {{{ +exe s:pA.'\\&[\ \\] <plug><C-r>=IMAP_PutTextWithMovement("\\[<++>\\]<++>")<cr>' +exe s:pA.'\\&(\ \\) <plug><C-r>=IMAP_PutTextWithMovement("\\(<++>\\)<++>")<cr>' +exe s:pA.'&$\ $ <plug>$$' +exe s:pA.'-sepmath1- :' +" }}} +" MATH arrows {{{ +let s:pA1 = s:pA."&Arrows." +exe s:pA1.'Leftarrow<Tab>⇠<plug>\Leftarrow ' +exe s:pA1.'leftarrow<Tab>↠<plug>\leftarrow' +exe s:pA1.'longleftarrow<Tab>↠<plug>\longleftarrow ' +exe s:pA1.'Longleftarrow<Tab>⇠<plug>\Longleftarrow ' +exe s:pA1.'rightarrow<Tab>→ <plug>\rightarrow ' +exe s:pA1.'longrightarrow<Tab>→ <plug>\longrightarrow ' +exe s:pA1.'Rightarrow<Tab>⇒ <plug>\Rightarrow ' +exe s:pA1.'Longrightarrow<Tab>⇒ <plug>\Longrightarrow ' +exe s:pA1.'leftrightarrow<Tab>⇆ <plug>\leftrightarrow ' +exe s:pA1.'longleftrightarrow<Tab>↔ <plug>\longleftrightarrow ' +exe s:pA1.'Leftrightarrow<Tab>⇔ <plug>\Leftrightarrow ' +exe s:pA1.'Longleftrightarrow<Tab>⇔ <plug>\Longleftrightarrow ' +exe s:pA1.'uparrow<Tab>↑ <plug>\uparrow ' +exe s:pA1.'Uparrow<Tab>⇑ <plug>\Uparrow ' +exe s:pA1.'downarrow<Tab>↓ <plug>\downarrow ' +exe s:pA1.'Downarrow<Tab>⇓ <plug>\Downarrow ' +exe s:pA1.'updownarrow<Tab>↕ <plug>\updownarrow ' +exe s:pA1.'Updownarrow<Tab>⇕ <plug>\Updownarrow ' +exe s:pA1.'nearrow<Tab>↗ <plug>\nearrow ' +exe s:pA1.'searrow<Tab>↘ <plug>\searrow ' +exe s:pA1.'swarrow<Tab>↙ <plug>\swarrow ' +exe s:pA1.'nwarrow<Tab>↖ <plug>\nwarrow ' +exe s:pA1.'mapsto<Tab>↦ <plug>\mapsto ' +exe s:pA1.'leadsto<Tab>↠<plug>\leadsto ' +exe s:pA1.'longmapsto<Tab>⇖ <plug>\longmapsto ' +exe s:pA1.'hookleftarrow<Tab>↩ <plug>\hookleftarrow ' +exe s:pA1.'hookrightarrow<Tab>↪ <plug>\hookrightarrow ' +exe s:pA1.'leftharpoonup<Tab>↼ <plug>\leftharpoonup ' +exe s:pA1.'leftharpoondown<Tab>↽ <plug>\leftharpoondown ' +exe s:pA1.'rightharpoonup<Tab>⇀ <plug>\rightharpoonup ' +exe s:pA1.'rightharpoondown<Tab>⇠<plug>\rightharpoondown ' +exe s:pA1.'rightleftharpoons<Tab>⇌ <plug>\rightleftharpoons ' +exe s:pA1.'overleftarrow<Tab> <plug>\overleftarrow ' +exe s:pA1.'overrightarrow<Tab> <plug>\overrightarrow ' +exe s:pA1.'overleftrightarrow<Tab> <plug>\overleftrightarrow ' +exe s:pA1.'underleftarrow<Tab> <plug>\underleftarrow ' +exe s:pA1.'underrightarrow<Tab> <plug>\underrightarrow ' +exe s:pA1.'underleftrightarrow<Tab> <plug>\underleftrightarrow ' +exe s:pA1.'xleftarrow<Tab> <plug>\xleftarrow ' +exe s:pA1.'xrightarrow<Tab> <plug>\xrightarrow ' +" }}} +" MATH Arrows2 {{{ +let s:pA1a = s:pA."Arrows2." +exe s:pA1a.'dashleftarrow<Tab>⇠<plug>\dashleftarrow ' +exe s:pA1a.'leftleftarrows<Tab>⇇ <plug>\leftleftarrows ' +exe s:pA1a.'leftrightarrows<Tab>⇆ <plug>\leftrightarrows ' +exe s:pA1a.'Lleftarrow<Tab>⇚ <plug>\Lleftarrow ' +exe s:pA1a.'twoheadleftarrow<Tab>↞ <plug>\twoheadleftarrow ' +exe s:pA1a.'leftarrowtail<Tab>↢ <plug>\leftarrowtail ' +exe s:pA1a.'leftrightharpoons<Tab>⇋ <plug>\leftrightharpoons ' +exe s:pA1a.'Lsh<Tab>↰ <plug>\Lsh ' +exe s:pA1a.'looparrowleft<Tab>↫ <plug>\looparrowleft ' +exe s:pA1a.'curvearrowleft<Tab>↶ <plug>\curvearrowleft ' +exe s:pA1a.'circlearrowleft<Tab>↺ <plug>\circlearrowleft ' +exe s:pA1a.'dashrightarrow<Tab>⇢ <plug>\dashrightarrow ' +exe s:pA1a.'rightrightarrows<Tab>⇉ <plug>\rightrightarrows ' +exe s:pA1a.'rightleftarrows<Tab>⇄ <plug>\rightleftarrows ' +exe s:pA1a.'Rrightarrow<Tab>⇛ <plug>\Rrightarrow ' +exe s:pA1a.'twoheadrightarrow<Tab>↠<plug>\twoheadrightarrow ' +exe s:pA1a.'rightarrowtail<Tab>↣ <plug>\rightarrowtail ' +exe s:pA1a.'rightleftharpoons<Tab>⇌ <plug>\rightleftharpoons ' +exe s:pA1a.'Rsh<Tab>↱ <plug>\Rsh ' +exe s:pA1a.'looparrowright<Tab>↬ <plug>\looparrowright ' +exe s:pA1a.'curvearrowright<Tab>↷ <plug>\curvearrowright ' +exe s:pA1a.'circlearrowright<Tab>↻ <plug>\circlearrowright ' +exe s:pA1a.'multimap<Tab>⊸ <plug>\multimap ' +exe s:pA1a.'upuparrows<Tab>⇈ <plug>\upuparrows ' +exe s:pA1a.'downdownarrows<Tab>⇊ <plug>\downdownarrows ' +exe s:pA1a.'upharpoonleft<Tab>↿ <plug>\upharpoonleft ' +exe s:pA1a.'upharpoonright<Tab>↾ <plug>\upharpoonright ' +exe s:pA1a.'downharpoonleft<Tab>⇃ <plug>\downharpoonleft ' +exe s:pA1a.'downharpoonright<Tab>⇂ <plug>\downharpoonright ' +exe s:pA1a.'rightsquigarrow<Tab>⇠<plug>\rightsquigarrow ' +exe s:pA1a.'leftrightsquigarrow<Tab>↠<plug>\leftrightsquigarrow ' +" }}} +" MATH nArrows {{{ +let s:pA1b = s:pA."&nArrows." +exe s:pA1b.'nleftarrow<Tab>↚ <plug>\nleftarrow ' +exe s:pA1b.'nLeftarrow<Tab>⇠<plug>\nLeftarrow ' +exe s:pA1b.'nleftrightarrow<Tab>↮ <plug>\nleftrightarrow ' +exe s:pA1b.'nLeftrightarrow<Tab>⇎ <plug>\nleftrightarrow ' +exe s:pA1b.'nrightarrow<Tab>↛ <plug>\nrightarrow ' +exe s:pA1b.'nRightarrow<Tab>⇠<plug>\nRightarrow ' +" }}} +" MATH Fonts {{{ +let s:pA2a = s:pA."&MathFonts." +exe s:pA2a.'mathbf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbf{<++>}<++>")<cr>' +exe s:pA2a.'mathrm{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathrm{<++>}<++>")<cr>' +exe s:pA2a.'mathsf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathsf{<++>}<++>")<cr>' +exe s:pA2a.'mathtt{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathtt{<++>}<++>")<cr>' +exe s:pA2a.'mathit{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathit{<++>}<++>")<cr>' +exe s:pA2a.'mathfrak{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathfrak{<++>}<++>")<cr>' +exe s:pA2a.'mathcal{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathcal{<++>}<++>")<cr>' +exe s:pA2a.'mathscr{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathscr{<++>}<++>")<cr>' +exe s:pA2a.'mathbb{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbb{<++>}<++>")<cr>' +" }}} +" Greek Letters small {{{ +let s:pA2 = s:pA."&Greek.&Small." +exe s:pA2.'alpha<Tab>`a\ \ α <plug>\alpha ' +exe s:pA2.'beta<Tab>`b\ \ β <plug>\beta ' +exe s:pA2.'gamma<Tab>`g\ \ γ <plug>\gamma ' +exe s:pA2.'delta<Tab>`d\ \ δ <plug>\delta ' +exe s:pA2.'epsilon<Tab>∊ <plug>\epsilon ' +exe s:pA2.'varepsilon<Tab>`e\ \ ε <plug>\varepsilon ' +exe s:pA2.'zeta<Tab>`z\ \ ζ <plug>\zeta ' +exe s:pA2.'eta<Tab>`h\ \ η <plug>\eta ' +exe s:pA2.'theta<Tab>`q\ \ θ <plug>\theta ' +exe s:pA2.'vartheta<Tab>Ï‘ <plug>\vartheta ' +exe s:pA2.'iota<Tab>`i\ \ ι <plug>\iota ' +exe s:pA2.'kappa<Tab>`k\ \ κ <plug>\kappa ' +exe s:pA2.'lambda<Tab>`l\ \ λ <plug>\lambda ' +exe s:pA2.'mu<Tab>`m\ \ μ <plug>\mu ' +exe s:pA2.'nu<Tab>`n\ \ ν <plug>\nu ' +exe s:pA2.'xi<Tab>`x\ \ ξ <plug>\xi ' +exe s:pA2.'pi<Tab>`p\ \ Ï€ <plug>\pi ' +exe s:pA2.'varpi<Tab>Ï– <plug>\varpi ' +exe s:pA2.'rho<Tab>`r\ \ Ï <plug>\rho ' +exe s:pA2.'varrho<Tab>ϱ <plug>\varrho ' +exe s:pA2.'sigma<Tab>`s\ \ σ <plug>\sigma ' +exe s:pA2.'varsigma<Tab>`v\ \ Ï‚ <plug>\varsigma ' +exe s:pA2.'tau<Tab>`t\ \ Ï„ <plug>\tau ' +exe s:pA2.'upsilon<Tab>`u\ \ Ï… <plug>\upsilon ' +exe s:pA2.'phi<Tab>φ <plug>\phi ' +exe s:pA2.'varphi<Tab>`f\ \ Ï• <plug>\varphi ' +exe s:pA2.'chi<Tab>`c\ \ χ <plug>\chi ' +exe s:pA2.'psi<Tab>`y\ \ ψ <plug>\psi ' +exe s:pA2.'omega<Tab>`w\ \ ω <plug>\omega ' +" }}} +" Greek Letters big {{{ +let s:pA3 = s:pA.'&Greek.&Big.' +exe s:pA3.'Alpha<Tab>`A\ \ A <plug>\Alpha ' +exe s:pA3.'Beta<Tab>`B\ \ B <plug>\Beta ' +exe s:pA3.'Gamma<Tab>`G\ \ Γ <plug>\Gamma ' +exe s:pA3.'Delta<Tab>`D\ \ Δ <plug>\Delta ' +exe s:pA3.'Epsilon<Tab>`E\ \ E <plug>\Epsilon ' +exe s:pA3.'Zeta<Tab>`Z\ \ Z <plug>\mathrm{Z} ' +exe s:pA3.'Eta<Tab>`H\ \ H <plug>\Eta ' +exe s:pA3.'Theta<Tab>Θ <plug>\Theta ' +exe s:pA3.'Iota<Tab>I <plug>\mathrm{I} ' +exe s:pA3.'Kappa<Tab>`K\ \ K <plug>\Kappa ' +exe s:pA3.'Lambda<Tab>`L\ \ Λ <plug>\Lambda ' +exe s:pA3.'Mu<Tab>`M\ \ M <plug>\Mu ' +exe s:pA3.'Nu<Tab>`N\ \ N <plug>\Nu ' +exe s:pA3.'Xi<Tab>`X\ \ Ξ <plug>\Xi ' +exe s:pA3.'Pi<Tab>`P\ \ Î <plug>\Pi ' +exe s:pA3.'Rho<Tab>`R\ \ P <plug>\Rho ' +exe s:pA3.'Sigma<Tab>`S\ \ Σ <plug>\Sigma ' +exe s:pA3.'Tau<Tab>`T\ \ T <plug>\Tau ' +exe s:pA3.'Upsilon<Tab>`U\ \ Y <plug>\Upsilon ' +exe s:pA3.'Phi<Tab>Φ <plug>\Phi ' +exe s:pA3.'Chi<Tab>`C\ \ X <plug>\Chi ' +exe s:pA3.'Psi<Tab>`Y\ \ Ψ <plug>\Psi ' +exe s:pA3.'Omega<Tab>`W\ \ Ω <plug>\Omega ' +" }}} +" BinaryRel1 {{{ +let s:pA4 = s:pA."&BinaryRel1." +exe s:pA4.'ll<Tab>≪ <plug>\ll ' +exe s:pA4.'lll<Tab>⋘ <plug>\lll ' +exe s:pA4.'leqslant<Tab>≤ <plug>\leqslant ' +exe s:pA4.'leq<Tab>≤ <plug>\leq ' +exe s:pA4.'leqq<Tab>≦ <plug>\leqq ' +exe s:pA4.'eqslantless<Tab>⋜ <plug>\eqslantless ' +exe s:pA4.'lessdot<Tab>â‹– <plug>\lessdot ' +exe s:pA4.'prec<Tab>≺ <plug>\prec ' +exe s:pA4.'preceq<Tab>≼ <plug>\preceq ' +exe s:pA4.'preccurlyeq<Tab>≼ <plug>\preccurlyeq ' +exe s:pA4.'curlyeqprec<Tab>⋞ <plug>\curlyeqprec ' +exe s:pA4.'lesssim<Tab>≲ <plug>\lesssim ' +exe s:pA4.'lessapprox<Tab> <plug>\lessapprox ' +exe s:pA4.'precsim<Tab>≾ <plug>\precsim ' +exe s:pA4.'precapprox<Tab> <plug>\precapprox ' +exe s:pA4.'in<Tab>∈ <plug>\in ' +exe s:pA4.'subset<Tab>`(\ \ ⊂ <plug>\subset ' +exe s:pA4.'Subset<Tab>`)\ \ â‹ <plug>\Subset ' +exe s:pA4.'subseteq<Tab>⊆ <plug>\subseteq ' +exe s:pA4.'subseteqq<Tab> <plug>\subseteqq ' +exe s:pA4.'sqsubset<Tab>⊠<plug>\sqsubset ' +exe s:pA4.'sqsubseteq<Tab>⊑ <plug>\sqsubseteq ' +exe s:pA4.'smile<Tab>⌣ <plug>\smile ' +exe s:pA4.'smallsmile<Tab>⌣ <plug>\smallsmile ' +exe s:pA4.'parallel<Tab>∥ <plug>\parallel ' +exe s:pA4.'shortparallel<Tab>∥ <plug>\shortparallel ' +exe s:pA4.'dashv<Tab>⊣ <plug>\dashv ' +exe s:pA4.'vdash<Tab>⊢ <plug>\vdash ' +exe s:pA4.'vDash<Tab>⊨ <plug>\vDash ' +exe s:pA4.'models<Tab>⊨ <plug>\models ' +exe s:pA4.'therefore<Tab>∴ <plug>\therefore ' +exe s:pA4.'backepsilon<Tab>∠<plug>\backepsilon ' +" }}} +" nBinaryRel1 {{{ +let s:pA4a = s:pA."&nBinaryRel1." +exe s:pA4a.'nless<Tab>≮ <plug>\nless ' +exe s:pA4a.'nleqslant<Tab>≰ <plug>\nleqslant ' +exe s:pA4a.'nleq<Tab> <plug>\nleq ' +exe s:pA4a.'lneq<Tab> <plug>\lneq ' +exe s:pA4a.'nleqq<Tab> <plug>\nleqq ' +exe s:pA4a.'lneqq<Tab>≨ <plug>\lneqq ' +exe s:pA4a.'lvertneqq<Tab> <plug>\lvertneqq ' +exe s:pA4a.'nprec<Tab>⊀ <plug>\nprec ' +exe s:pA4a.'npreceq<Tab>â‹ <plug>\npreceq ' +exe s:pA4a.'precneqq<Tab> <plug>\precneqq ' +exe s:pA4a.'lnsim<Tab>⋦ <plug>\lnsim ' +exe s:pA4a.'lnapprox<Tab> <plug>\lnapprox ' +exe s:pA4a.'precnsim<Tab>⋨ <plug>\precnsim ' +exe s:pA4a.'precnapprox<Tab> <plug>\precnapprox ' +exe s:pA4a.'notin<Tab>∉ <plug>\notin ' +exe s:pA4a.'nsubseteq<Tab>⊈ <plug>\nsubseteq ' +exe s:pA4a.'varsubsetneq<Tab> <plug>\varsubsetneq ' +exe s:pA4a.'subsetneq<Tab>⊊ <plug>\subsetneq ' +exe s:pA4a.'nsubseteqq<Tab> <plug>\nsubseteqq ' +exe s:pA4a.'varsubsetneqq<Tab> <plug>\varsubsetneqq ' +exe s:pA4a.'subsetneqq<Tab>⊈ <plug>\subsetneqq ' +exe s:pA4a.'nparallel<Tab>∦ <plug>\nparallel ' +exe s:pA4a.'nshortparallel<Tab> <plug>\nshortparallel ' +exe s:pA4a.'nvdash<Tab>⊬ <plug>\nvdash ' +exe s:pA4a.'nvDash<Tab>⊠<plug>\nvDash ' +" }}} +" BinaryRel2 {{{ +let s:pA5 = s:pA."&BinaryRel2." +exe s:pA5.'gg<Tab>≫ <plug>\gg ' +exe s:pA5.'ggg<Tab>â‹™ <plug>\ggg ' +exe s:pA5.'gggtr<Tab>â‹™ <plug>\gggtr ' +exe s:pA5.'geqslant<Tab> <plug>\geqslant ' +exe s:pA5.'geq<Tab>≥ <plug>\geq ' +exe s:pA5.'geqq<Tab>≧ <plug>\geqq ' +exe s:pA5.'eqslantgtr<Tab> <plug>\eqslantgtr ' +exe s:pA5.'gtrdot<Tab>â‹— <plug>\gtrdot ' +exe s:pA5.'succ<Tab>≻ <plug>\succ ' +exe s:pA5.'succeq<Tab>≽ <plug>\succeq ' +exe s:pA5.'succcurlyeq<Tab>≽ <plug>\succcurlyeq ' +exe s:pA5.'curlyeqsucc<Tab>⋟ <plug>\curlyeqsucc ' +exe s:pA5.'gtrsim<Tab>≳ <plug>\gtrsim ' +exe s:pA5.'gtrapprox<Tab> <plug>\gtrapprox ' +exe s:pA5.'succsim<Tab>≿ <plug>\succsim ' +exe s:pA5.'succapprox<Tab> <plug>\succapprox ' +exe s:pA5.'ni<Tab>∋ <plug>\ni ' +exe s:pA5.'owns<Tab> <plug>\owns ' +exe s:pA5.'supset<Tab>⊃ <plug>\supset ' +exe s:pA5.'Supset<Tab>â‹‘ <plug>\Supset ' +exe s:pA5.'supseteq<Tab>⊇ <plug>\supseteq ' +exe s:pA5.'supseteqq<Tab> <plug>\supseteqq ' +exe s:pA5.'sqsupset<Tab>⊠<plug>\sqsupset ' +exe s:pA5.'sqsupseteq<Tab>⊒ <plug>\sqsupseteq ' +exe s:pA5.'frown<Tab>⌢ <plug>\frown ' +exe s:pA5.'smallfrown<Tab>⌢ <plug>\smallfrown ' +exe s:pA5.'mid<Tab>∣ <plug>\mid ' +exe s:pA5.'shortmid<Tab> <plug>\shortmid ' +exe s:pA5.'between<Tab>≬ <plug>\between ' +exe s:pA5.'Vdash<Tab>⊩ <plug>\Vdash ' +exe s:pA5.'bowtie<Tab>⋈ <plug>\bowtie ' +exe s:pA5.'Join<Tab>⋈ <plug>\Join ' +exe s:pA5.'pitchfork<Tab>â‹” <plug>\pitchfork ' +" }}} +" {{{ nBinaryRel2 +let s:pA5a = s:pA."n&BinaryRel2." "TODO: dorobiæ logarytmy +exe s:pA5a.'ngtr<Tab>≯ <plug>\ngtr ' +exe s:pA5a.'ngeqslant<Tab>≱ <plug>\ngeqslant ' +exe s:pA5a.'ngeq<Tab> <plug>\ngeq ' +exe s:pA5a.'gneq<Tab> <plug>\gneq ' +exe s:pA5a.'ngeqq<Tab> <plug>\ngeqq ' +exe s:pA5a.'gneqq<Tab>≩ <plug>\gneqq ' +exe s:pA5a.'nsucc<Tab>⊠<plug>\nsucc ' +exe s:pA5a.'nsucceq<Tab>â‹¡ <plug>\nsucceq ' +exe s:pA5a.'succneqq<Tab> <plug>\succneqq ' +exe s:pA5a.'gnsim<Tab>â‹§ <plug>\gnsim ' +exe s:pA5a.'gnapprox<Tab> <plug>\gnapprox ' +exe s:pA5a.'succnsim<Tab>â‹© <plug>\succnsim ' +exe s:pA5a.'succnapprox<Tab> <plug>\succnapprox ' +exe s:pA5a.'nsupseteq<Tab>⊉ <plug>\nsupseteq ' +exe s:pA5a.'varsupsetneq<Tab> <plug>\varsupsetneq ' +exe s:pA5a.'supsetneq<Tab>⊋ <plug>\supsetneq ' +exe s:pA5a.'nsupseteqq<Tab> <plug>\nsupseteqq ' +exe s:pA5a.'varsupsetneqq<Tab> <plug>\varsupsetneqq ' +exe s:pA5a.'supsetneqq<Tab> <plug>\supsetneqq ' +exe s:pA5a.'nmid<Tab>∤ <plug>\nmid ' +exe s:pA5a.'nshortmid<Tab> <plug>\nshortmid ' +exe s:pA5a.'nVdash<Tab>⊮ <plug>\nVdash ' +" }}} +" {{{ BinaryRel3 +let s:pA6 = s:pA."&BinaryRel3." +exe s:pA6.'doteq<Tab>≠<plug>\doteq ' +exe s:pA6.'circeq<Tab>≗ <plug>\circeq ' +exe s:pA6.'eqcirc<Tab>≖ <plug>\eqcirc ' +exe s:pA6.'risingdotseq<Tab>≓ <plug>\risingdotseq ' +exe s:pA6.'doteqdot<Tab>≑ <plug>\doteqdot ' +exe s:pA6.'Doteq<Tab>≑ <plug>\Doteq ' +exe s:pA6.'fallingdotseq<Tab>≒ <plug>\fallingdotseq ' +exe s:pA6.'triangleq<Tab>≜ <plug>\triangleq ' +exe s:pA6.'bumpeq<Tab>≠<plug>\bumpeq ' +exe s:pA6.'Bumpeq<Tab>≎ <plug>\Bumpeq ' +exe s:pA6.'equiv<Tab>`=\ \ ≡ <plug>\equiv ' +exe s:pA6.'sim<Tab>∼ <plug>\sim ' +exe s:pA6.'thicksim<Tab>∼ <plug>\thicksim ' +exe s:pA6.'backsim<Tab>∽ <plug>\backsim ' +exe s:pA6.'simeq<Tab>≃ <plug>\simeq ' +exe s:pA6.'backsimeq<Tab>â‹ <plug>\backsimeq ' +exe s:pA6.'cong<Tab>≅ <plug>\cong ' +exe s:pA6.'approx<tab>=~\ \ ≈ <plug>\approx ' +exe s:pA6.'thickapprox<Tab>≈ <plug>\thickapprox ' +exe s:pA6.'approxeq<Tab>≊ <plug>\approxeq ' +exe s:pA6.'blacktriangleleft<Tab>â—€ <plug>\blacktriangleleft ' +exe s:pA6.'vartriangleleft<Tab>⊲ <plug>\vartriangleleft ' +exe s:pA6.'trianglelefteq<Tab>⊴ <plug>\trianglelefteq ' +exe s:pA6.'blacktriangleright<Tab>â–¶ <plug>\blacktriangleright ' +exe s:pA6.'vartriangleright<Tab>⊳ <plug>\vartriangleright ' +exe s:pA6.'trianglerighteq<Tab>⊵ <plug>\trianglerighteq ' +exe s:pA6.'perp<Tab>⊥ <plug>\perp ' +exe s:pA6.'asymp<Tab>≠<plug>\asymp ' +exe s:pA6.'Vvdash<Tab>⊪ <plug>\Vvdash ' +exe s:pA6.'propto<Tab>∠<plug>\propto ' +exe s:pA6.'varpropto<Tab>∠<plug>\varpropto ' +exe s:pA6.'because<Tab>∵ <plug>\because ' +" }}} +" {{{ nBinaryRel3 +let s:pA6a = s:pA."&nBinaryRel3." +exe s:pA6a.'neq<Tab>≠<plug>\neq ' +exe s:pA6a.'nsim<Tab>≠<plug>\nsim ' +exe s:pA6a.'ncong<Tab>≆ <plug>\ncong ' +exe s:pA6a.'ntriangleleft<Tab>⋪ <plug>\ntriangleleft ' +exe s:pA6a.'ntrianglelefteq<Tab>⋬ <plug>\ntrianglelefteq ' +exe s:pA6a.'ntriangleright<Tab>â‹« <plug>\ntriangleright ' +exe s:pA6a.'ntrianglerighteq<Tab>â‹ <plug>\ntrianglerighteq ' +" }}} +" {{{ BinaryRel4 +let s:pA7 = s:pA."&BinaryRel4." +exe s:pA7.'lessgtr<Tab>≶ <plug>\lessgtr ' +exe s:pA7.'gtrless<Tab>≷ <plug>\gtrless ' +exe s:pA7.'lesseqgtr<Tab>⋚ <plug>\lesseqgtr ' +exe s:pA7.'gtreqless<Tab>â‹› <plug>\gtreqless ' +exe s:pA7.'lesseqqgtr<Tab> <plug>\lesseqqgtr ' +exe s:pA7.'gtreqqless<Tab> <plug>\gtreqqless ' +" }}} +" {{{ BigOp +let s:pA8a = s:pA."&BigOp." +exe s:pA8a.'limits<Tab> <plug>\limits' +exe s:pA8a.'nolimits<Tab> <plug>\nolimits' +exe s:pA8a.'displaylimits<Tab> <plug>\displaylimits' +exe s:pA8a.'-seplimits- :' +exe s:pA8a.'bigcap<Tab>`-\ \ â‹‚ <plug>\bigcap' +exe s:pA8a.'bigcup<Tab>`+\ \ ⋃ <plug>\bigcup' +exe s:pA8a.'bigodot<Tab>⊙ <plug>\bigodot' +exe s:pA8a.'bigoplus<Tab>⊕ <plug>\bigoplus' +exe s:pA8a.'bigotimes<Tab>⊗ <plug>\bigotimes' +exe s:pA8a.'bigsqcup<Tab>⊔ <plug>\bigsqcup' +exe s:pA8a.'biguplus<Tab>⊎ <plug>\biguplus' +exe s:pA8a.'bigvee<Tab>â‹ <plug>\bigvee' +exe s:pA8a.'bigwedge<Tab>â‹€ <plug>\bigwedge' +exe s:pA8a.'coprod<Tab>∠<plug>\coprod' +exe s:pA8a.'int<Tab>∫ <plug>\int' +exe s:pA8a.'iint<Tab>∬ <plug>\int' +exe s:pA8a.'iiint<Tab>∠<plug>\int' +exe s:pA8a.'oint<Tab>∮ <plug>\oint' +exe s:pA8a.'prod<Tab>∠<plug>\prod' +exe s:pA8a.'sum<Tab>∑ <plug>\sum' +" }}} +" {{{ BinaryOp +let s:pA8 = s:pA."&BinaryOp." +exe s:pA8.'pm<Tab>± <plug>\pm ' +exe s:pA8.'mp<Tab>∓ <plug>\mp ' +exe s:pA8.'dotplus<Tab>∔ <plug>\dotplus ' +exe s:pA8.'cdot<Tab>`.\ \ â‹… <plug>\cdot ' +exe s:pA8.'centerdot<Tab>â‹… <plug>\centerdot ' +exe s:pA8.'times<Tab>`*\ \ × <plug>\times ' +exe s:pA8.'ltimes<Tab>⋉ <plug>\ltimes ' +exe s:pA8.'rtimes<Tab>⋊ <plug>\rtimes ' +exe s:pA8.'leftthreetimes<Tab>â‹‹ <plug>\leftthreetimes ' +exe s:pA8.'rightthreetimes<Tab>⋌ <plug>\rightthreetimes ' +exe s:pA8.'div<Tab>÷ <plug>\div ' +exe s:pA8.'divideontimes<Tab>⋇ <plug>\divideontimes ' +exe s:pA8.'bmod<Tab> <plug>\bmod ' +exe s:pA8.'ast<Tab>∗ <plug>\ast ' +exe s:pA8.'star<Tab>⋆ <plug>\star ' +exe s:pA8.'setminus<Tab>`\\\ \ ∖ <plug>\setminus ' +exe s:pA8.'smallsetminus<Tab>∖ <plug>\smallsetminus ' +exe s:pA8.'diamond<Tab>â‹„ <plug>\diamond ' +exe s:pA8.'wr<Tab>≀ <plug>\wr ' +exe s:pA8.'intercal<Tab>⊺ <plug>\intercal ' +exe s:pA8.'circ<Tab>`@\ \ ∘ <plug>\circ ' +exe s:pA8.'bigcirc<Tab>â—‹ <plug>\bigcirc ' +exe s:pA8.'bullet<Tab>∙ <plug>\bullet ' +exe s:pA8.'cap<Tab>∩ <plug>\cap ' +exe s:pA8.'Cap<Tab>â‹’ <plug>\Cap ' +exe s:pA8.'cup<Tab>∪ <plug>\cup ' +exe s:pA8.'Cup<Tab>â‹“ <plug>\Cup ' +exe s:pA8.'sqcap<Tab>⊓ <plug>\sqcap ' +exe s:pA8.'sqcup<Tab>⊔ <plug>\sqcup' +exe s:pA8.'amalg<Tab> <plug>\amalg ' +exe s:pA8.'uplus<Tab>⊎ <plug>\uplus ' +exe s:pA8.'triangleleft<Tab>â— <plug>\triangleleft ' +exe s:pA8.'triangleright<Tab>â–· <plug>\triangleright ' +exe s:pA8.'bigtriangleup<Tab>â–³ <plug>\bigtriangleup ' +exe s:pA8.'bigtriangledown<Tab>â–½ <plug>\bigtriangledown ' +exe s:pA8.'vee<Tab>∨ <plug>\vee ' +exe s:pA8.'veebar<Tab>⊻ <plug>\veebar ' +exe s:pA8.'curlyvee<Tab>⋎ <plug>\curlyvee ' +exe s:pA8.'wedge<Tab>`&\ \ ∧ <plug>\wedge ' +exe s:pA8.'barwedge<Tab>⊼ <plug>\barwedge ' +exe s:pA8.'doublebarwedge<Tab>⌆ <plug>\doublebarwedge ' +exe s:pA8.'curlywedge<Tab>â‹ <plug>\curlywedge ' +exe s:pA8.'oplus<Tab>⊕ <plug>\oplus ' +exe s:pA8.'ominus<Tab>⊖ <plug>\ominus ' +exe s:pA8.'otimes<Tab>⊗ <plug>\otimes ' +exe s:pA8.'oslash<Tab>⊘ <plug>\oslash ' +exe s:pA8.'boxplus<Tab>⊞ <plug>\boxplus ' +exe s:pA8.'boxminus<Tab>⊟ <plug>\boxminus ' +exe s:pA8.'boxtimes<Tab>⊠<plug>\boxtimes ' +exe s:pA8.'boxdot<Tab>⊡ <plug>\boxdot ' +exe s:pA8.'odot<Tab>⊙ <plug>\odot ' +exe s:pA8.'circledast<Tab>⊛ <plug>\circledast ' +exe s:pA8.'circleddash<Tab>⊠<plug>\circleddash ' +exe s:pA8.'circledcirc<Tab>⊚ <plug>\circledcirc ' +exe s:pA8.'dagger<Tab>†<plug>\dagger ' +exe s:pA8.'ddagger<Tab>‡ <plug>\ddagger ' +exe s:pA8.'lhd<Tab>⊲ <plug>\lhd ' +exe s:pA8.'unlhd<Tab>⊴ <plug>\unlhd ' +exe s:pA8.'rhd<Tab>⊳ <plug>\rhd ' +exe s:pA8.'unrhd<Tab>⊵ <plug>\unrhd ' +" }}} +" {{{ Other1 +let s:pA9 = s:pA."&Other1." +exe s:pA9.'hat<Tab>â <plug>\hat ' +exe s:pA9.'check<Tab>ÇŽ <plug>\check ' +exe s:pA9.'grave<Tab>à <plug>\grave ' +exe s:pA9.'acute<Tab>á <plug>\acute ' +exe s:pA9.'dot<Tab>ȧ <plug>\dot ' +exe s:pA9.'ddot<Tab>ä <plug>\ddot ' +exe s:pA9.'tilde<Tab>`,\ \ ã <plug>\tilde ' +exe s:pA9.'breve<Tab>ă <plug>\breve ' +exe s:pA9.'bar<Tab>Ä <plug>\bar ' +exe s:pA9.'vec<Tab>a⃗ <plug>\vec ' +exe s:pA9.'aleph<Tab>× <plug>\aleph ' +exe s:pA9.'hbar<Tab>â„ <plug>\hbar ' +exe s:pA9.'imath<Tab> <plug>\imath ' +exe s:pA9.'jmath<Tab> <plug>\jmath ' +exe s:pA9.'ell<Tab>â„“ <plug>\ell ' +exe s:pA9.'wp<Tab>℘ <plug>\wp ' +exe s:pA9.'Re<Tab>ℜ <plug>\Re ' +exe s:pA9.'Im<Tab>â„‘ <plug>\Im ' +exe s:pA9.'partial<Tab>∂ <plug>\partial ' +exe s:pA9.'infty<Tab>`8\ \ ∞ <plug>\infty ' +exe s:pA9.'prime<Tab>′ <plug>\prime ' +exe s:pA9.'emptyset<Tab>∅ <plug>\emptyset ' +exe s:pA9.'nabla<Tab>∇ <plug>\nabla ' +exe s:pA9.'surd<Tab>√ <plug>\surd ' +exe s:pA9.'top<Tab>⊤ <plug>\top ' +exe s:pA9.'bot<Tab>⊥ <plug>\bot ' +exe s:pA9.'angle<Tab>∠<plug>\angle ' +exe s:pA9.'triangle<Tab>â–³ <plug>\triangle ' +exe s:pA9.'backslash<Tab>\\ <plug>\backslash ' +exe s:pA9.'forall<Tab>∀ <plug>\forall ' +exe s:pA9.'exists<Tab>∃ <plug>\exists ' +exe s:pA9.'neg<Tab>¬ <plug>\neg ' +exe s:pA9.'flat<Tab>â™ <plug>\flat ' +exe s:pA9.'natural<Tab>â™® <plug>\natural ' +exe s:pA9.'sharp<Tab>♯ <plug>\sharp ' +exe s:pA9.'clubsuit<Tab>♣ <plug>\clubsuit ' +exe s:pA9.'diamondsuit<Tab>♢ <plug>\diamondsuit ' +exe s:pA9.'heartsuit<Tab>♡ <plug>\heartsuit ' +exe s:pA9.'spadesuit<Tab>â™ <plug>\spadesuit ' +exe s:pA9.'S<Tab>§ <plug>\S ' +exe s:pA9.'P<Tab>¶ <plug>\P' +" }}} +" {{{ MathCreating +let s:pA10 = s:pA."&MathCreating." +exe s:pA10.'not<Tab> <plug>\not' +exe s:pA10.'mkern<Tab> <plug>\mkern' +exe s:pA10.'mathbin<Tab> <plug>\mathbin' +exe s:pA10.'mathrel<Tab> <plug>\mathrel' +exe s:pA10.'stackrel<Tab> <plug>\stackrel' +exe s:pA10.'mathord<Tab> <plug>\mathord' +" }}} +" {{{ Styles +let s:pA11 = s:pA."&Styles." +exe s:pA11.'displaystyle<Tab> <plug>\displaystyle' +exe s:pA11.'textstyle<Tab> <plug>\textstyle' +exe s:pA11.'scritpstyle<Tab> <plug>\scritpstyle' +exe s:pA11.'scriptscriptstyle<Tab> <plug>\scriptscriptstyle' +" }}} +" {{{ MathDiacritics +let s:pA12 = s:pA."&MathDiacritics." +exe s:pA12.'acute{}<Tab>á <plug><C-r>=IMAP_PutTextWithMovement("\\acute{<++>}<++>")<cr>' +exe s:pA12.'bar{}<Tab>`_\ \ Ä <plug><C-r>=IMAP_PutTextWithMovement("\\bar{<++>}<++>")<cr>' +exe s:pA12.'breve{}<Tab>ă <plug><C-r>=IMAP_PutTextWithMovement("\\breve{<++>}<++>")<cr>' +exe s:pA12.'check{}<Tab>ÇŽ <plug><C-r>=IMAP_PutTextWithMovement("\\check{<++>}<++>")<cr>' +exe s:pA12.'ddot{}<Tab>`:\ \ ä <plug><C-r>=IMAP_PutTextWithMovement("\\ddot{<++>}<++>")<cr>' +exe s:pA12.'dot{}<Tab>`;\ \ ȧ <plug><C-r>=IMAP_PutTextWithMovement("\\dot{<++>}<++>")<cr>' +exe s:pA12.'grave{}<Tab>à <plug><C-r>=IMAP_PutTextWithMovement("\\grave{<++>}<++>")<cr>' +exe s:pA12.'hat{}<Tab>`^\ \ â <plug><C-r>=IMAP_PutTextWithMovement("\\hat{<++>}<++>")<cr>' +exe s:pA12.'tilde{}<tab>`~\ \ ã <plug><C-r>=IMAP_PutTextWithMovement("\\tilde{<++>}<++>")<cr>' +exe s:pA12.'vec{}<Tab>a⃗ <plug><C-r>=IMAP_PutTextWithMovement("\\vec{<++>}<++>")<cr>' +exe s:pA12.'widehat{}<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\widehat{<++>}<++>")<cr>' +exe s:pA12.'widetilde{}<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\widetilde{<++>}<++>")<cr>' +exe s:pA12.'imath<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\imath")<cr>' +exe s:pA12.'jmath<Tab> <plug><C-r>=IMAP_PutTextWithMovement("\\jmath")<cr>' +" }}} +" {{{ OverlineAndCo +let s:pA13 = s:pA."&OverlineAndCo." +exe s:pA13.'overline{} <plug><C-r>=IMAP_PutTextWithMovement("\\overline{}")<cr>' +exe s:pA13.'underline{} <plug><C-r>=IMAP_PutTextWithMovement("\\underline{}")<cr>' +exe s:pA13.'overrightarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overrightarrow{}")<cr>' +exe s:pA13.'overleftarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overleftarrow{}")<cr>' +exe s:pA13.'overbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\overbrace{}")<cr>' +exe s:pA13.'underbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\underbrace{}")<cr>' +" }}} +" {{{ Symbols1 +let s:pA14a = s:pA."&Symbols1." +exe s:pA14a.'forall<Tab>∀ <plug>\forall ' +exe s:pA14a.'exists<Tab>∃ <plug>\exists ' +exe s:pA14a.'nexists<Tab>∄ <plug>\nexists ' +exe s:pA14a.'neg<Tab>¬ <plug>\neg ' +exe s:pA14a.'top<Tab>⊤ <plug>\top ' +exe s:pA14a.'bot<Tab>⊥ <plug>\bot ' +exe s:pA14a.'emptyset<Tab>∅ <plug>\emptyset ' +exe s:pA14a.'varnothing<Tab>⌀ <plug>\varnothing ' +exe s:pA14a.'infty<Tab>∞ <plug>\infty ' +exe s:pA14a.'aleph<Tab>× <plug>\aleph ' +exe s:pA14a.'beth<Tab>ב <plug>\beth ' +exe s:pA14a.'gimel<Tab>×’ <plug>\gimel ' +exe s:pA14a.'daleth<Tab>ד <plug>\daleth ' +exe s:pA14a.'hbar<Tab> <plug>\hbar ' +exe s:pA14a.'hslash<Tab>â„ <plug>\hslash ' +exe s:pA14a.'diagup<Tab>â„ <plug>\diagup ' +exe s:pA14a.'vert<Tab>\| <plug>\vert ' +exe s:pA14a.'Vert<Tab>∥ <plug>\Vert ' +exe s:pA14a.'backslash<Tab>\\ <plug>\backslash ' +exe s:pA14a.'diagdown<Tab> <plug>\diagdown ' +exe s:pA14a.'Bbbk<Tab>ᵕ <plug>\Bbbk ' +exe s:pA14a.'P<Tab>¶ <plug>\P ' +exe s:pA14a.'S<Tab>§ <plug>\S ' +" }}} +" {{{ Symbols2 +let s:pA14b = s:pA."&Symbols2." +exe s:pA14b.'# <plug>\# ' +exe s:pA14b.'% <plug>\% ' +exe s:pA14b.'_<Tab> <plug>\_ ' +exe s:pA14b.'$ <plug>\$ ' +exe s:pA14b.'& <plug>\& ' +exe s:pA14b.'imath<Tab> <plug>\imath ' +exe s:pA14b.'jmath<Tab> <plug>\jmath ' +exe s:pA14b.'ell<Tab>â„“ <plug>\ell ' +exe s:pA14b.'wp<Tab>℘ <plug>\wp ' +exe s:pA14b.'Re<Tab>ℜ <plug>\Re ' +exe s:pA14b.'Im<Tab>â„‘ <plug>\Im ' +exe s:pA14b.'prime<Tab>′ <plug>\prime ' +exe s:pA14b.'backprime<Tab>‵ <plug>\backprime ' +exe s:pA14b.'nabla<Tab>∇ <plug>\nabla ' +exe s:pA14b.'surd<Tab>√ <plug>\surd ' +exe s:pA14b.'flat<Tab>â™ <plug>\flat ' +exe s:pA14b.'sharp<Tab>♯ <plug>\sharp ' +exe s:pA14b.'natural<Tab>â™® <plug>\natural ' +exe s:pA14b.'eth<Tab>ð <plug>\eth ' +exe s:pA14b.'bigstar<Tab>★ <plug>\bigstar ' +exe s:pA14b.'circledS<Tab>Ⓢ <plug>\circledS ' +exe s:pA14b.'Finv<Tab>Ⅎ <plug>\Finv ' +exe s:pA14b.'dag<Tab>†<plug>\dag ' +exe s:pA14b.'ddag<Tab>‡ <plug>\ddag ' +" }}} +" {{{ Symbols3 +let s:pA14c = s:pA."&Symbols3." +exe s:pA14c.'angle<Tab>∠<plug>\angle ' +exe s:pA14c.'measuredangle<Tab>∡ <plug>\measuredangle ' +exe s:pA14c.'sphericalangle<Tab>∢ <plug>\sphericalangle ' +exe s:pA14c.'spadesuit<Tab>â™ <plug>\spadesuit ' +exe s:pA14c.'heartsuit<Tab>♡ <plug>\heartsuit ' +exe s:pA14c.'diamondsuit<Tab>♢ <plug>\diamondsuit ' +exe s:pA14c.'clubsuit<Tab>♣ <plug>\clubsuit ' +exe s:pA14c.'lozenge<Tab>â—Š <plug>\lozenge ' +exe s:pA14c.'blacklozenge<Tab>â—† <plug>\blacklozenge ' +exe s:pA14c.'Diamond<Tab>â—‡ <plug>\Diamond ' +exe s:pA14c.'triangle<Tab>â–³ <plug>\triangle ' +exe s:pA14c.'vartriangle<Tab>â–³ <plug>\vartriangle ' +exe s:pA14c.'blacktriangle<Tab>â–² <plug>\blacktriangle ' +exe s:pA14c.'triangledown<Tab>â–½ <plug>\triangledown ' +exe s:pA14c.'blacktriangledown<Tab>â–¼ <plug>\blacktriangledown ' +exe s:pA14c.'Box<Tab>â–¡ <plug>\Box ' +exe s:pA14c.'square<Tab>â–¡ <plug>\square ' +exe s:pA14c.'blacksquare<Tab>â– <plug>\blacksquare ' +exe s:pA14c.'complement<Tab>∠<plug>\complement ' +exe s:pA14c.'mho<Tab>â„§ <plug>\mho ' +exe s:pA14c.'Game<Tab>â… <plug>\Game ' +exe s:pA14c.'partial<Tab>`6\ \ ∂ <plug>\partial ' +exe s:pA14c.'smallint<Tab>∫ <plug>\smallint ' +" }}} +" {{{ Logic +let s:pA15 = s:pA."&Logic." +exe s:pA15.'lnot<Tab>¬ <plug>\lnot ' +exe s:pA15.'lor<Tab>∨ <plug>\lor ' +exe s:pA15.'land<Tab>∧ <plug>\land ' +" }}} +" {{{ Limits1 +let s:pA16 = s:pA."&Limits1." +exe s:pA16.'left<Tab>( <plug>\left' +exe s:pA16.'right<Tab>) <plug>\right' +exe s:pA16.'-sepbigl- :' +exe s:pA16.'bigl<Tab> <plug>\bigl' +exe s:pA16.'Bigl<Tab> <plug>\Bigl' +exe s:pA16.'biggl<Tab> <plug>\biggl' +exe s:pA16.'Biggl<Tab> <plug>\Biggl' +exe s:pA16.'-sepbigr- :' +exe s:pA16.'bigr<Tab> <plug>\bigr' +exe s:pA16.'Bigr<Tab> <plug>\Bigr' +exe s:pA16.'biggr<Tab> <plug>\biggr' +exe s:pA16.'Biggr<Tab> <plug>\Biggr' +exe s:pA16.'-sepbig- :' +exe s:pA16.'big<Tab> <plug>\big' +exe s:pA16.'bigm<Tab> <plug>\bigm' +exe s:pA16.'-sepfloor- :' +exe s:pA16.'lfloor<Tab>⌊ <plug>\lfloor ' +exe s:pA16.'lceil<Tab>⌈ <plug>\lceil ' +exe s:pA16.'rfloor<Tab>⌋ <plug>\rfloor ' +exe s:pA16.'rceil<Tab>⌉ <plug>\rceil ' +exe s:pA16.'-sepangle- :' +exe s:pA16.'langle<Tab>〈 <plug>\langle ' +exe s:pA16.'rangle<Tab>〉 <plug>\rangle ' +" }}} +" {{{ Limits2 +let s:pA16a = s:pA."&Limits2." +exe s:pA16a.'ulcorner<Tab>⌜ <plug>\ulcorner ' +exe s:pA16a.'urcorner<Tab>⌠<plug>\urcorner ' +exe s:pA16a.'llcorner<Tab>⌞ <plug>\llcorner ' +exe s:pA16a.'rlcorner<Tab>⌟ <plug>\rlcorner ' +exe s:pA16a.'-sepcorner- :' +exe s:pA16a.'vert<Tab>\| <plug>\vert ' +exe s:pA16a.'Vert<Tab>∥ <plug>\Vert ' +exe s:pA16a.'lvert<Tab> <plug>\lvert ' +exe s:pA16a.'lVert<Tab> <plug>\lVert ' +exe s:pA16a.'rvert<Tab> <plug>\rvert ' +exe s:pA16a.'rVert<Tab> <plug>\rVert ' +exe s:pA16a.'uparrow<Tab>↑ <plug>\uparrow ' +exe s:pA16a.'Uparrow<Tab>⇑ <plug>\Uparrow ' +exe s:pA16a.'downarrow<Tab>↓ <plug>\downarrow ' +exe s:pA16a.'Downarrow<Tab>⇓ <plug>\Downarrow ' +exe s:pA16a.'updownarrow<Tab>↕ <plug>\updownarrow ' +exe s:pA16a.'Updownarrow<Tab>⇕ <plug>\Updownarrow ' +exe s:pA16a.'lgroup<Tab> <plug>\lgroup ' +exe s:pA16a.'rgroup<Tab> <plug>\rgroup ' +exe s:pA16a.'lmoustache<Tab>∫ <plug>\lmoustache ' +exe s:pA16a.'rmoustache<Tab> <plug>\rmoustache ' +exe s:pA16a.'arrowvert<Tab> <plug>\arrowvert ' +exe s:pA16a.'Arrowvert<Tab> <plug>\Arrowvert ' +exe s:pA16a.'bracevert<Tab> <plug>\bracevert ' +" }}} +" {{{ Log-likes +let s:pA17 = s:pA."Lo&g-likes." +exe s:pA17.'arccos<Tab> <plug>\arccos ' +exe s:pA17.'arcsin<Tab> <plug>\arcsin ' +exe s:pA17.'arctan<Tab> <plug>\arctan ' +exe s:pA17.'arg<Tab> <plug>\arg ' +exe s:pA17.'cos<Tab> <plug>\cos ' +exe s:pA17.'cosh<Tab> <plug>\cosh ' +exe s:pA17.'cot<Tab> <plug>\cot ' +exe s:pA17.'coth<Tab> <plug>\coth ' +exe s:pA17.'csc<Tab> <plug>\csc ' +exe s:pA17.'deg<Tab> <plug>\deg ' +exe s:pA17.'det<Tab> <plug>\det ' +exe s:pA17.'dim<Tab> <plug>\dim ' +exe s:pA17.'exp<Tab> <plug>\exp ' +exe s:pA17.'gcd<Tab> <plug>\gcd ' +exe s:pA17.'hom<Tab> <plug>\hom ' +exe s:pA17.'inf<Tab> <plug>\inf ' +exe s:pA17.'injlim<Tab> <plug>\injlim ' +exe s:pA17.'ker<Tab> <plug>\ker ' +exe s:pA17.'lg<Tab> <plug>\lg ' +exe s:pA17.'lim<Tab> <plug>\lim ' +exe s:pA17.'liminf<Tab> <plug>\liminf ' +exe s:pA17.'limsup<Tab> <plug>\limsup ' +exe s:pA17.'ln<Tab> <plug>\ln ' +exe s:pA17.'log<Tab> <plug>\log ' +exe s:pA17.'max<Tab> <plug>\max ' +exe s:pA17.'min<Tab> <plug>\min ' +exe s:pA17.'Pr<Tab> <plug>\Pr ' +exe s:pA17.'projlim<Tab> <plug>\projlim ' +exe s:pA17.'sec<Tab> <plug>\sec ' +exe s:pA17.'sin<Tab> <plug>\sin ' +exe s:pA17.'sinh<Tab> <plug>\sinh ' +exe s:pA17.'sup<Tab> <plug>\sup ' +exe s:pA17.'tan<Tab> <plug>\tan ' +exe s:pA17.'tanh<Tab> <plug>\tanh ' +exe s:pA17.'varlimsup<Tab> <plug>\varlimsup ' +exe s:pA17.'varliminf<Tab> <plug>\varliminf ' +exe s:pA17.'varinjlim<Tab> <plug>\varinjlim ' +exe s:pA17.'varprojlim<Tab> <plug>\varprojlim ' +" }}} +" {{{ MathSpacing +let s:pA18 = s:pA."MathSpacing." +exe s:pA18.', <plug>\, ' +exe s:pA18.': <plug>\: ' +exe s:pA18.'; <plug>\; ' +exe s:pA18.'[space] <plug>\ ' +exe s:pA18.'quad<Tab> <plug>\quad ' +exe s:pA18.'qquad<Tab> <plug>\qquad ' +exe s:pA18.'! <plug>\! ' +exe s:pA18.'thinspace<Tab> <plug>\thinspace ' +exe s:pA18.'medspace<Tab> <plug>\medspace ' +exe s:pA18.'thickspace<Tab> <plug>\thickspace ' +exe s:pA18.'negthinspace<Tab> <plug>\negthinspace ' +exe s:pA18.'negmedspace<Tab> <plug>\negmedspace ' +exe s:pA18.'negthickspace<Tab> <plug>\negthickspace ' +" 1}}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:fenc=utf-8 diff --git a/vim-latex/ftplugin/latex-suite/mathmacros.vim b/vim-latex/ftplugin/latex-suite/mathmacros.vim new file mode 100644 index 0000000..553965c --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/mathmacros.vim @@ -0,0 +1,730 @@ +"============================================================================= +" File: mathmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for everything mathematical in latex. +"============================================================================= + +if !(has('gui_running') && g:Tex_MathMenus && g:Tex_Menus) + finish +endif + +let s:MathMenuName = g:Tex_MenuPrefix.'&Math.' + +function! Tex_MathMenuRemove() + exe 'silent! aunmenu '.s:MathMenuName +endfunction + +let s:pA = 'amenu <silent> '.g:Tex_NextMenuLocation.' '.s:MathMenuName +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + +" brackets and dollars {{{ +exe s:pA.'\\&[\ \\] <plug><C-r>=IMAP_PutTextWithMovement("\\[<++>\\]<++>")<cr>' +exe s:pA.'\\&(\ \\) <plug><C-r>=IMAP_PutTextWithMovement("\\(<++>\\)<++>")<cr>' +exe s:pA.'&$\ $ <plug>$$' +exe s:pA.'-sepmath1- :' +" }}} +" MATH arrows {{{ +let s:pA1 = s:pA."&Arrows." +exe s:pA1.'Leftarrow <plug>\leftarrow ' +exe s:pA1.'leftarrow <plug>\leftarrow' +exe s:pA1.'longleftarrow <plug>\longleftarrow ' +exe s:pA1.'Leftarrow <plug>\Leftarrow ' +exe s:pA1.'Longleftarrow <plug>\Longleftarrow ' +exe s:pA1.'rightarrow <plug>\rightarrow ' +exe s:pA1.'longrightarrow <plug>\longrightarrow ' +exe s:pA1.'Rightarrow <plug>\Rightarrow ' +exe s:pA1.'Longrightarrow <plug>\Longrightarrow ' +exe s:pA1.'leftrightarrow <plug>\leftrightarrow ' +exe s:pA1.'longleftrightarrow <plug>\longleftrightarrow ' +exe s:pA1.'Leftrightarrow <plug>\Leftrightarrow ' +exe s:pA1.'Longleftrightarrow <plug>\Longleftrightarrow ' +exe s:pA1.'uparrow <plug>\uparrow ' +exe s:pA1.'Uparrow <plug>\Uparrow ' +exe s:pA1.'downarrow <plug>\downarrow ' +exe s:pA1.'Downarrow <plug>\Downarrow ' +exe s:pA1.'updownarrow <plug>\updownarrow ' +exe s:pA1.'Updownarrow <plug>\Updownarrow ' +exe s:pA1.'nearrow <plug>\nearrow ' +exe s:pA1.'searrow <plug>\searrow ' +exe s:pA1.'swarrow <plug>\swarrow ' +exe s:pA1.'nwarrow <plug>\nwarrow ' +exe s:pA1.'mapsto <plug>\mapsto ' +exe s:pA1.'leadsto <plug>\leadsto ' +exe s:pA1.'longmapsto <plug>\longmapsto ' +exe s:pA1.'hookleftarrow <plug>\hookleftarrow ' +exe s:pA1.'hookrightarrow <plug>\hookrightarrow ' +exe s:pA1.'leftharpoonup <plug>\leftharpoonup ' +exe s:pA1.'leftharpoondown <plug>\leftharpoondown ' +exe s:pA1.'rightharpoonup <plug>\rightharpoonup ' +exe s:pA1.'rightharpoondown <plug>\rightharpoondown ' +exe s:pA1.'rightleftharpoons <plug>\rightleftharpoons ' +exe s:pA1.'overleftarrow <plug>\overleftarrow ' +exe s:pA1.'overrightarrow <plug>\overrightarrow ' +exe s:pA1.'overleftrightarrow <plug>\overleftrightarrow ' +exe s:pA1.'underleftarrow <plug>\underleftarrow ' +exe s:pA1.'underrightarrow <plug>\underrightarrow ' +exe s:pA1.'underleftrightarrow <plug>\underleftrightarrow ' +exe s:pA1.'xleftarrow <plug>\xleftarrow ' +exe s:pA1.'xrightarrow <plug>\xrightarrow ' +" }}} + + +" MATH nArrows {{{ +let s:pA1a = s:pA."&nArrows." +exe s:pA1a.'nleftarrow <plug>\nleftarrow ' +exe s:pA1a.'nLeftarrow <plug>\nLeftarrow ' +exe s:pA1a.'nleftrightarrow <plug>\nleftrightarrow ' +exe s:pA1a.'nrightarrow <plug>\nrightarrow ' +exe s:pA1a.'nRightarrow <plug>\nRightarrow ' +" }}} +" MATH Arrows2 {{{ +let s:pA1a = s:pA."Arrows2." +exe s:pA1a.'dashleftarrow <plug>\dashleftarrow ' +exe s:pA1a.'leftleftarrows <plug>\leftleftarrows ' +exe s:pA1a.'leftrightarrows <plug>\leftrightarrows ' +exe s:pA1a.'Lleftarrow <plug>\Lleftarrow ' +exe s:pA1a.'twoheadleftarrow <plug>\twoheadleftarrow ' +exe s:pA1a.'leftarrowtail <plug>\leftarrowtail ' +exe s:pA1a.'leftrightharpoons <plug>\leftrightharpoons ' +exe s:pA1a.'Lsh <plug>\Lsh ' +exe s:pA1a.'looparrowleft <plug>\looparrowleft ' +exe s:pA1a.'curvearrowleft <plug>\curvearrowleft ' +exe s:pA1a.'circlearrowleft <plug>\circlearrowleft ' +exe s:pA1a.'dashrightarrow <plug>\dashrightarrow ' +exe s:pA1a.'rightrightarrows <plug>\rightrightarrows ' +exe s:pA1a.'rightleftarrows <plug>\rightleftarrows ' +exe s:pA1a.'Rrightarrow <plug>\Rrightarrow ' +exe s:pA1a.'twoheadrightarrow <plug>\twoheadrightarrow ' +exe s:pA1a.'rightarrowtail <plug>\rightarrowtail ' +exe s:pA1a.'rightleftharpoons <plug>\rightleftharpoons ' +exe s:pA1a.'Rsh <plug>\Rsh ' +exe s:pA1a.'looparrowright <plug>\looparrowright ' +exe s:pA1a.'curvearrowright <plug>\curvearrowright ' +exe s:pA1a.'circlearrowright <plug>\circlearrowright ' +exe s:pA1a.'multimap <plug>\multimap ' +exe s:pA1a.'upuparrows <plug>\upuparrows ' +exe s:pA1a.'downdownarrows <plug>\downdownarrows ' +exe s:pA1a.'upharpoonleft <plug>\upharpoonleft ' +exe s:pA1a.'upharpoonright <plug>\upharpoonright ' +exe s:pA1a.'downharpoonleft <plug>\downharpoonleft ' +exe s:pA1a.'downharpoonright <plug>\downharpoonright ' +exe s:pA1a.'rightsquigarrow <plug>\rightsquigarrow ' +exe s:pA1a.'leftrightsquigarrow <plug>\leftrightsquigarrow ' +" }}} +" MATH Fonts {{{ +let s:pA2a = s:pA."&MathFonts." +exe s:pA2a.'mathbf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbf{<++>}<++>")<cr>' +exe s:pA2a.'mathrm{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathrm{<++>}<++>")<cr>' +exe s:pA2a.'mathsf{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathsf{<++>}<++>")<cr>' +exe s:pA2a.'mathtt{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathtt{<++>}<++>")<cr>' +exe s:pA2a.'mathit{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathit{<++>}<++>")<cr>' +exe s:pA2a.'mathfrak{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathfrak{<++>}<++>")<cr>' +exe s:pA2a.'mathcal{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathcal{<++>}<++>")<cr>' +exe s:pA2a.'mathscr{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathscr{<++>}<++>")<cr>' +exe s:pA2a.'mathbb{} <plug><C-r>=IMAP_PutTextWithMovement("\\mathbb{<++>}<++>")<cr>' +" }}} +" Greek Letters small {{{ +let s:pA2 = s:pA."&Greek.&Small." +exe s:pA2.'alpha<Tab>`a <plug>\alpha ' +exe s:pA2.'beta<Tab>`b <plug>\beta ' +exe s:pA2.'gamma<Tab>`g <plug>\gamma ' +exe s:pA2.'delta<Tab>`d <plug>\delta ' +exe s:pA2.'epsilon <plug>\epsilon ' +exe s:pA2.'varepsilon<Tab>`e <plug>\varepsilon ' +exe s:pA2.'zeta<Tab>`z <plug>\zeta ' +exe s:pA2.'eta<Tab>`h <plug>\eta ' +exe s:pA2.'theta<Tab>`q <plug>\theta ' +exe s:pA2.'vartheta <plug>\vartheta ' +exe s:pA2.'iota<Tab>`i <plug>\iota ' +exe s:pA2.'kappa<Tab>`k <plug>\kappa ' +exe s:pA2.'lambda<Tab>`l <plug>\lambda ' +exe s:pA2.'mu<Tab>`m <plug>\mu ' +exe s:pA2.'nu<Tab>`n <plug>\nu ' +exe s:pA2.'xi<Tab>`x <plug>\xi ' +exe s:pA2.'pi<Tab>`p <plug>\pi ' +exe s:pA2.'varpi <plug>\varpi ' +exe s:pA2.'rho<Tab>`r <plug>\rho ' +exe s:pA2.'varrho <plug>\varrho ' +exe s:pA2.'sigma<Tab>`s <plug>\sigma ' +exe s:pA2.'varsigma<Tab>`v <plug>\varsigma ' +exe s:pA2.'tau<Tab>`t <plug>\tau ' +exe s:pA2.'upsilon<Tab>`u <plug>\upsilon ' +exe s:pA2.'phi <plug>\phi ' +exe s:pA2.'varphi<Tab>`f <plug>\varphi ' +exe s:pA2.'chi<Tab>`c <plug>\chi ' +exe s:pA2.'psi<Tab>`y <plug>\psi ' +exe s:pA2.'omega<Tab>`w <plug>\omega ' +" }}} +" Greek Letters big {{{ +let s:pA3 = s:pA.'&Greek.&Big.' +exe s:pA3.'Alpha<Tab>`A <plug>\Alpha ' +exe s:pA3.'Beta<Tab>`B <plug>\Beta ' +exe s:pA3.'Gamma<Tab>`G <plug>\Gamma ' +exe s:pA3.'Delta<Tab>`D <plug>\Delta ' +exe s:pA3.'Epsilon<Tab>`E <plug>\Epsilon ' +exe s:pA3.'Zeta<Tab>`Z <plug>\mathrm{Z} ' +exe s:pA3.'Eta<Tab>`H <plug>\Eta ' +exe s:pA3.'Theta <plug>\Theta ' +exe s:pA3.'Iota <plug>\mathrm{I} ' +exe s:pA3.'Kappa<Tab>`K <plug>\Kappa ' +exe s:pA3.'Lambda<Tab>`L <plug>\Lambda ' +exe s:pA3.'Mu<Tab>`M <plug>\Mu ' +exe s:pA3.'Nu<Tab>`N <plug>\Nu ' +exe s:pA3.'Xi<Tab>`X <plug>\Xi ' +exe s:pA3.'Pi<Tab>`P <plug>\Pi ' +exe s:pA3.'Rho<Tab>`R <plug>\Rho ' +exe s:pA3.'Sigma<Tab>`S <plug>\Sigma ' +exe s:pA3.'Tau<Tab>`T <plug>\Tau ' +exe s:pA3.'Upsilon<Tab>`U <plug>\Upsilon ' +exe s:pA3.'Phi <plug>\Phi ' +exe s:pA3.'Chi<Tab>`C <plug>\Chi ' +exe s:pA3.'Psi<Tab>`Y <plug>\Psi ' +exe s:pA3.'Omega<Tab>`W <plug>\Omega ' +" }}} +" BinaryRel1 {{{ +let s:pA4 = s:pA."&BinaryRel1." +exe s:pA4.'ll <plug>\ll ' +exe s:pA4.'lll <plug>\lll ' +exe s:pA4.'leqslant <plug>\leqslant ' +exe s:pA4.'leq <plug>\leq ' +exe s:pA4.'leqq <plug>\leqq ' +exe s:pA4.'eqslantless <plug>\eqslantless ' +exe s:pA4.'lessdot <plug>\lessdot ' +exe s:pA4.'prec <plug>\prec ' +exe s:pA4.'preceq <plug>\preceq ' +exe s:pA4.'preccurlyeq <plug>\preccurlyeq ' +exe s:pA4.'curlyeqprec <plug>\curlyeqprec ' +exe s:pA4.'lesssim <plug>\lesssim ' +exe s:pA4.'lessapprox <plug>\lessapprox ' +exe s:pA4.'precsim <plug>\precsim ' +exe s:pA4.'precapprox <plug>\precapprox ' +exe s:pA4.'in <plug>\in ' +exe s:pA4.'subset<Tab>`( <plug>\subset ' +exe s:pA4.'Subset<Tab>`) <plug>\Subset ' +exe s:pA4.'subseteq <plug>\subseteq ' +exe s:pA4.'subseteqq <plug>\subseteqq ' +exe s:pA4.'sqsubset <plug>\sqsubset ' +exe s:pA4.'sqsubseteq <plug>\sqsubseteq ' +exe s:pA4.'smile <plug>\smile ' +exe s:pA4.'smallsmile <plug>\smallsmile ' +exe s:pA4.'parallel <plug>\parallel ' +exe s:pA4.'shortparallel <plug>\shortparallel ' +exe s:pA4.'dashv <plug>\dashv ' +exe s:pA4.'vdash <plug>\vdash ' +exe s:pA4.'vDash <plug>\vDash ' +exe s:pA4.'models <plug>\models ' +exe s:pA4.'therefore <plug>\therefore ' +exe s:pA4.'backepsilon <plug>\backepsilon ' +" }}} +" nBinaryRel1 {{{ +let s:pA4a = s:pA."&nBinaryRel1." +exe s:pA4a.'nless <plug>\nless ' +exe s:pA4a.'nleqslant <plug>\nleqslant ' +exe s:pA4a.'nleq <plug>\nleq ' +exe s:pA4a.'lneq <plug>\lneq ' +exe s:pA4a.'nleqq <plug>\nleqq ' +exe s:pA4a.'lneqq <plug>\lneqq ' +exe s:pA4a.'lvertneqq <plug>\lvertneqq ' +exe s:pA4a.'nprec <plug>\nprec ' +exe s:pA4a.'npreceq <plug>\npreceq ' +exe s:pA4a.'precneqq <plug>\precneqq ' +exe s:pA4a.'lnsim <plug>\lnsim ' +exe s:pA4a.'lnapprox <plug>\lnapprox ' +exe s:pA4a.'precnsim <plug>\precnsim ' +exe s:pA4a.'precnapprox <plug>\precnapprox ' +exe s:pA4a.'notin <plug>\notin ' +exe s:pA4a.'nsubseteq <plug>\nsubseteq ' +exe s:pA4a.'varsubsetneq <plug>\varsubsetneq ' +exe s:pA4a.'subsetneq <plug>\subsetneq ' +exe s:pA4a.'nsubseteqq <plug>\nsubseteqq ' +exe s:pA4a.'varsubsetneqq <plug>\varsubsetneqq ' +exe s:pA4a.'subsetneqq <plug>\subsetneqq ' +exe s:pA4a.'nparallel <plug>\nparallel ' +exe s:pA4a.'nshortparallel <plug>\nshortparallel ' +exe s:pA4a.'nvdash <plug>\nvdash ' +exe s:pA4a.'nvDash <plug>\nvDash ' +" }}} +" BinaryRel2 {{{ +let s:pA5 = s:pA."&BinaryRel2." +exe s:pA5.'gg <plug>\gg ' +exe s:pA5.'ggg <plug>\ggg ' +exe s:pA5.'gggtr <plug>\gggtr ' +exe s:pA5.'geqslant <plug>\geqslant ' +exe s:pA5.'geq <plug>\geq ' +exe s:pA5.'geqq <plug>\geqq ' +exe s:pA5.'eqslantgtr <plug>\eqslantgtr ' +exe s:pA5.'gtrdot <plug>\gtrdot ' +exe s:pA5.'succ <plug>\succ ' +exe s:pA5.'succeq <plug>\succeq ' +exe s:pA5.'succcurlyeq <plug>\succcurlyeq ' +exe s:pA5.'curlyeqsucc <plug>\curlyeqsucc ' +exe s:pA5.'gtrsim <plug>\gtrsim ' +exe s:pA5.'gtrapprox <plug>\gtrapprox ' +exe s:pA5.'succsim <plug>\succsim ' +exe s:pA5.'succapprox <plug>\succapprox ' +exe s:pA5.'ni <plug>\ni ' +exe s:pA5.'owns <plug>\owns ' +exe s:pA5.'supset <plug>\supset ' +exe s:pA5.'Supset <plug>\Supset ' +exe s:pA5.'supseteq <plug>\supseteq ' +exe s:pA5.'supseteqq <plug>\supseteqq ' +exe s:pA5.'sqsupset <plug>\sqsupset ' +exe s:pA5.'sqsupseteq <plug>\sqsupseteq ' +exe s:pA5.'frown <plug>\frown ' +exe s:pA5.'smallfrown <plug>\smallfrown ' +exe s:pA5.'mid <plug>\mid ' +exe s:pA5.'shortmid <plug>\shortmid ' +exe s:pA5.'between <plug>\between ' +exe s:pA5.'Vdash <plug>\Vdash ' +exe s:pA5.'bowtie <plug>\bowtie ' +exe s:pA5.'Join <plug>\Join ' +exe s:pA5.'pitchfork <plug>\pitchfork ' +" }}} +" {{{ nBinaryRel2 +let s:pA5a = s:pA."n&BinaryRel2." "TODO: dorobiæ logarytmy +exe s:pA5a.'ngtr <plug>\ngtr ' +exe s:pA5a.'ngeqslant <plug>\ngeqslant ' +exe s:pA5a.'ngeq <plug>\ngeq ' +exe s:pA5a.'gneq <plug>\gneq ' +exe s:pA5a.'ngeqq <plug>\ngeqq ' +exe s:pA5a.'gneqq <plug>\gneqq ' +exe s:pA5a.'nsucc <plug>\nsucc ' +exe s:pA5a.'nsucceq <plug>\nsucceq ' +exe s:pA5a.'succneqq <plug>\succneqq ' +exe s:pA5a.'gnsim <plug>\gnsim ' +exe s:pA5a.'gnapprox <plug>\gnapprox ' +exe s:pA5a.'succnsim <plug>\succnsim ' +exe s:pA5a.'succnapprox <plug>\succnapprox ' +exe s:pA5a.'nsupseteq <plug>\nsupseteq ' +exe s:pA5a.'varsupsetneq <plug>\varsupsetneq ' +exe s:pA5a.'supsetneq <plug>\supsetneq ' +exe s:pA5a.'nsupseteqq <plug>\nsupseteqq ' +exe s:pA5a.'varsupsetneqq <plug>\varsupsetneqq ' +exe s:pA5a.'supsetneqq <plug>\supsetneqq ' +exe s:pA5a.'nmid <plug>\nmid ' +exe s:pA5a.'nshortmid <plug>\nshortmid ' +exe s:pA5a.'nVdash <plug>\nVdash ' +" }}} +" {{{ BinaryRel3 +let s:pA6 = s:pA."&BinaryRel3." +exe s:pA6.'doteq <plug>\doteq ' +exe s:pA6.'circeq <plug>\circeq ' +exe s:pA6.'eqcirc <plug>\eqcirc ' +exe s:pA6.'risingdotseq <plug>\risingdotseq ' +exe s:pA6.'doteqdot <plug>\doteqdot ' +exe s:pA6.'Doteq <plug>\Doteq ' +exe s:pA6.'fallingdotseq <plug>\fallingdotseq ' +exe s:pA6.'triangleq <plug>\triangleq ' +exe s:pA6.'bumpeq <plug>\bumpeq ' +exe s:pA6.'Bumpeq <plug>\Bumpeq ' +exe s:pA6.'equiv<Tab>`= <plug>\equiv ' +exe s:pA6.'sim <plug>\sim ' +exe s:pA6.'thicksim <plug>\thicksim ' +exe s:pA6.'backsim <plug>\backsim ' +exe s:pA6.'simeq <plug>\simeq ' +exe s:pA6.'backsimeq <plug>\backsimeq ' +exe s:pA6.'cong <plug>\cong ' +exe s:pA6.'approx<tab>=~ <plug>\approx ' +exe s:pA6.'thickapprox <plug>\thickapprox ' +exe s:pA6.'approxeq <plug>\approxeq ' +exe s:pA6.'blacktriangleleft <plug>\blacktriangleleft ' +exe s:pA6.'vartriangleleft <plug>\vartriangleleft ' +exe s:pA6.'trianglelefteq <plug>\trianglelefteq ' +exe s:pA6.'blacktriangleright <plug>\blacktriangleright ' +exe s:pA6.'vartriangleright <plug>\vartriangleright ' +exe s:pA6.'trianglerighteq <plug>\trianglerighteq ' +exe s:pA6.'perp <plug>\perp ' +exe s:pA6.'asymp <plug>\asymp ' +exe s:pA6.'Vvdash <plug>\Vvdash ' +exe s:pA6.'propto <plug>\propto ' +exe s:pA6.'varpropto <plug>\varpropto ' +exe s:pA6.'because <plug>\because ' +" }}} +" {{{ nBinaryRel3 +let s:pA6a = s:pA."&nBinaryRel3." +exe s:pA6a.'neq <plug>\neq ' +exe s:pA6a.'nsim <plug>\nsim ' +exe s:pA6a.'ncong <plug>\ncong ' +exe s:pA6a.'ntriangleleft <plug>\ntriangleleft ' +exe s:pA6a.'ntrianglelefteq <plug>\ntrianglelefteq ' +exe s:pA6a.'ntriangleright <plug>\ntriangleright ' +exe s:pA6a.'ntrianglerighteq <plug>\ntrianglerighteq ' +" }}} +" {{{ BinaryRel4 +let s:pA7 = s:pA."&BinaryRel4." +exe s:pA7.'lessgtr <plug>\lessgtr ' +exe s:pA7.'gtrless <plug>\gtrless ' +exe s:pA7.'lesseqgtr <plug>\lesseqgtr ' +exe s:pA7.'gtreqless <plug>\gtreqless ' +exe s:pA7.'lesseqqgtr <plug>\lesseqqgtr ' +exe s:pA7.'gtreqqless <plug>\gtreqqless ' +" }}} +" {{{ BigOp +let s:pA8a = s:pA."&BigOp." +exe s:pA8a.'limits <plug>\limits' +exe s:pA8a.'nolimits <plug>\nolimits' +exe s:pA8a.'displaylimits <plug>\displaylimits' +exe s:pA8a.'-seplimits- :' +exe s:pA8a.'bigcap<Tab>`- <plug>\bigcap' +exe s:pA8a.'bigcup<Tab>`+ <plug>\bigcup' +exe s:pA8a.'bigodot <plug>\bigodot' +exe s:pA8a.'bigoplus <plug>\bigoplus' +exe s:pA8a.'bigotimes <plug>\bigotimes' +exe s:pA8a.'bigsqcup <plug>\bigsqcup' +exe s:pA8a.'biguplus <plug>\biguplus' +exe s:pA8a.'bigvee <plug>\bigvee' +exe s:pA8a.'bigwedge <plug>\bigwedge' +exe s:pA8a.'coprod <plug>\coprod' +exe s:pA8a.'int <plug>\int' +exe s:pA8a.'oint <plug>\oint' +exe s:pA8a.'prod <plug>\prod' +exe s:pA8a.'sum <plug>\sum' +" }}} +" {{{ BinaryOp +let s:pA8 = s:pA."&BinaryOp." +exe s:pA8.'pm <plug>\pm ' +exe s:pA8.'mp <plug>\mp ' +exe s:pA8.'dotplus <plug>\dotplus ' +exe s:pA8.'cdot<Tab>`. <plug>\cdot ' +exe s:pA8.'centerdot <plug>\centerdot ' +exe s:pA8.'times<Tab>`* <plug>\times ' +exe s:pA8.'ltimes <plug>\ltimes ' +exe s:pA8.'rtimes <plug>\rtimes ' +exe s:pA8.'leftthreetimes <plug>\leftthreetimes ' +exe s:pA8.'rightthreetimes <plug>\rightthreetimes ' +exe s:pA8.'div <plug>\div ' +exe s:pA8.'divideontimes <plug>\divideontimes ' +exe s:pA8.'bmod <plug>\bmod ' +exe s:pA8.'ast <plug>\ast ' +exe s:pA8.'star <plug>\star ' +exe s:pA8.'setminus<Tab>`\\ <plug>\setminus ' +exe s:pA8.'smallsetminus <plug>\smallsetminus ' +exe s:pA8.'diamond <plug>\diamond ' +exe s:pA8.'wr <plug>\wr ' +exe s:pA8.'intercal <plug>\intercal ' +exe s:pA8.'circ<Tab>`@ <plug>\circ ' +exe s:pA8.'bigcirc <plug>\bigcirc ' +exe s:pA8.'bullet <plug>\bullet ' +exe s:pA8.'cap <plug>\cap ' +exe s:pA8.'Cap <plug>\Cap ' +exe s:pA8.'cup <plug>\cup ' +exe s:pA8.'Cup <plug>\Cup ' +exe s:pA8.'sqcap <plug>\sqcap ' +exe s:pA8.'sqcup <plug>\sqcup' +exe s:pA8.'amalg <plug>\amalg ' +exe s:pA8.'uplus <plug>\uplus ' +exe s:pA8.'triangleleft <plug>\triangleleft ' +exe s:pA8.'triangleright <plug>\triangleright ' +exe s:pA8.'bigtriangleup <plug>\bigtriangleup ' +exe s:pA8.'bigtriangledown <plug>\bigtriangledown ' +exe s:pA8.'vee <plug>\vee ' +exe s:pA8.'veebar <plug>\veebar ' +exe s:pA8.'curlyvee <plug>\curlyvee ' +exe s:pA8.'wedge<Tab>`& <plug>\wedge ' +exe s:pA8.'barwedge <plug>\barwedge ' +exe s:pA8.'doublebarwedge <plug>\doublebarwedge ' +exe s:pA8.'curlywedge <plug>\curlywedge ' +exe s:pA8.'oplus <plug>\oplus ' +exe s:pA8.'ominus <plug>\ominus ' +exe s:pA8.'otimes <plug>\otimes ' +exe s:pA8.'oslash <plug>\oslash ' +exe s:pA8.'boxplus <plug>\boxplus ' +exe s:pA8.'boxminus <plug>\boxminus ' +exe s:pA8.'boxtimes <plug>\boxtimes ' +exe s:pA8.'boxdot <plug>\boxdot ' +exe s:pA8.'odot <plug>\odot ' +exe s:pA8.'circledast <plug>\circledast ' +exe s:pA8.'circleddash <plug>\circleddash ' +exe s:pA8.'circledcirc <plug>\circledcirc ' +exe s:pA8.'dagger <plug>\dagger ' +exe s:pA8.'ddagger <plug>\ddagger ' +exe s:pA8.'lhd <plug>\lhd ' +exe s:pA8.'unlhd <plug>\unlhd ' +exe s:pA8.'rhd <plug>\rhd ' +exe s:pA8.'unrhd <plug>\unrhd ' +" }}} +" {{{ Other1 +let s:pA9 = s:pA."&Other1." +exe s:pA9.'hat <plug>\hat ' +exe s:pA9.'check <plug>\check ' +exe s:pA9.'grave <plug>\grave ' +exe s:pA9.'acute <plug>\acute ' +exe s:pA9.'dot <plug>\dot ' +exe s:pA9.'ddot <plug>\ddot ' +exe s:pA9.'tilde<Tab>`, <plug>\tilde ' +exe s:pA9.'breve <plug>\breve ' +exe s:pA9.'bar <plug>\bar ' +exe s:pA9.'vec <plug>\vec ' +exe s:pA9.'aleph <plug>\aleph ' +exe s:pA9.'hbar <plug>\hbar ' +exe s:pA9.'imath <plug>\imath ' +exe s:pA9.'jmath <plug>\jmath ' +exe s:pA9.'ell <plug>\ell ' +exe s:pA9.'wp <plug>\wp ' +exe s:pA9.'Re <plug>\Re ' +exe s:pA9.'Im <plug>\Im ' +exe s:pA9.'partial <plug>\partial ' +exe s:pA9.'infty<Tab>`8 <plug>\infty ' +exe s:pA9.'prime <plug>\prime ' +exe s:pA9.'emptyset <plug>\emptyset ' +exe s:pA9.'nabla <plug>\nabla ' +exe s:pA9.'surd <plug>\surd ' +exe s:pA9.'top <plug>\top ' +exe s:pA9.'bot <plug>\bot ' +exe s:pA9.'angle <plug>\angle ' +exe s:pA9.'triangle <plug>\triangle ' +exe s:pA9.'backslash <plug>\backslash ' +exe s:pA9.'forall <plug>\forall ' +exe s:pA9.'exists <plug>\exists ' +exe s:pA9.'neg <plug>\neg ' +exe s:pA9.'flat <plug>\flat ' +exe s:pA9.'natural <plug>\natural ' +exe s:pA9.'sharp <plug>\sharp ' +exe s:pA9.'clubsuit <plug>\clubsuit ' +exe s:pA9.'diamondsuit <plug>\diamondsuit ' +exe s:pA9.'heartsuit <plug>\heartsuit ' +exe s:pA9.'spadesuit <plug>\spadesuit ' +exe s:pA9.'S <plug>\S ' +exe s:pA9.'P <plug>\P' +" }}} +" {{{ MathCreating +let s:pA10 = s:pA."&MathCreating." +exe s:pA10.'not <plug>\not' +exe s:pA10.'mkern <plug>\mkern' +exe s:pA10.'mathbin <plug>\mathbin' +exe s:pA10.'mathrel <plug>\mathrel' +exe s:pA10.'stackrel <plug>\stackrel' +exe s:pA10.'mathord <plug>\mathord' +" }}} +" {{{ Styles +let s:pA11 = s:pA."&Styles." +exe s:pA11.'displaystyle <plug>\displaystyle' +exe s:pA11.'textstyle <plug>\textstyle' +exe s:pA11.'scritpstyle <plug>\scritpstyle' +exe s:pA11.'scriptscriptstyle <plug>\scriptscriptstyle' +" }}} +" {{{ MathDiacritics +let s:pA12 = s:pA."&MathDiacritics." +exe s:pA12.'acute{} <plug><C-r>=IMAP_PutTextWithMovement("\\acute{<++>}<++>")<cr>' +exe s:pA12.'bar{}<Tab>`_ <plug><C-r>=IMAP_PutTextWithMovement("\\bar{<++>}<++>")<cr>' +exe s:pA12.'breve{} <plug><C-r>=IMAP_PutTextWithMovement("\\breve{<++>}<++>")<cr>' +exe s:pA12.'check{} <plug><C-r>=IMAP_PutTextWithMovement("\\check{<++>}<++>")<cr>' +exe s:pA12.'ddot{}<Tab>`: <plug><C-r>=IMAP_PutTextWithMovement("\\ddot{<++>}<++>")<cr>' +exe s:pA12.'dot{}<Tab>`; <plug><C-r>=IMAP_PutTextWithMovement("\\dot{<++>}<++>")<cr>' +exe s:pA12.'grave{} <plug><C-r>=IMAP_PutTextWithMovement("\\grave{<++>}<++>")<cr>' +exe s:pA12.'hat{}<Tab>`^ <plug><C-r>=IMAP_PutTextWithMovement("\\hat{<++>}<++>")<cr>' +exe s:pA12.'tilde{}<tab>`~ <plug><C-r>=IMAP_PutTextWithMovement("\\tilde{<++>}<++>")<cr>' +exe s:pA12.'vec{} <plug><C-r>=IMAP_PutTextWithMovement("\\vec{<++>}<++>")<cr>' +exe s:pA12.'widehat{} <plug><C-r>=IMAP_PutTextWithMovement("\\widehat{<++>}<++>")<cr>' +exe s:pA12.'widetilde{} <plug><C-r>=IMAP_PutTextWithMovement("\\widetilde{<++>}<++>")<cr>' +exe s:pA12.'imath <plug><C-r>=IMAP_PutTextWithMovement("\\imath")<cr>' +exe s:pA12.'jmath <plug><C-r>=IMAP_PutTextWithMovement("\\jmath")<cr>' +" }}} +" {{{ OverlineAndCo +let s:pA13 = s:pA."&OverlineAndCo." +exe s:pA13.'overline{} <plug><C-r>=IMAP_PutTextWithMovement("\\overline{}")<cr>' +exe s:pA13.'underline{} <plug><C-r>=IMAP_PutTextWithMovement("\\underline{}")<cr>' +exe s:pA13.'overrightarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overrightarrow{}")<cr>' +exe s:pA13.'overleftarrow{} <plug><C-r>=IMAP_PutTextWithMovement("\\overleftarrow{}")<cr>' +exe s:pA13.'overbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\overbrace{}")<cr>' +exe s:pA13.'underbrace{} <plug><C-r>=IMAP_PutTextWithMovement("\\underbrace{}")<cr>' +" }}} +" {{{ Symbols1 +let s:pA14a = s:pA."&Symbols1." +exe s:pA14a.'forall <plug>\forall ' +exe s:pA14a.'exists <plug>\exists ' +exe s:pA14a.'nexists <plug>\nexists ' +exe s:pA14a.'neg <plug>\neg ' +exe s:pA14a.'top <plug>\top ' +exe s:pA14a.'bot <plug>\bot ' +exe s:pA14a.'emptyset <plug>\emptyset ' +exe s:pA14a.'varnothing <plug>\varnothing ' +exe s:pA14a.'infty <plug>\infty ' +exe s:pA14a.'aleph <plug>\aleph ' +exe s:pA14a.'beth <plug>\beth ' +exe s:pA14a.'gimel <plug>\gimel ' +exe s:pA14a.'daleth <plug>\daleth ' +exe s:pA14a.'hbar <plug>\hbar ' +exe s:pA14a.'hslash <plug>\hslash ' +exe s:pA14a.'diagup <plug>\diagup ' +exe s:pA14a.'vert <plug>\vert ' +exe s:pA14a.'Vert <plug>\Vert ' +exe s:pA14a.'backslash <plug>\backslash ' +exe s:pA14a.'diagdown <plug>\diagdown ' +exe s:pA14a.'Bbbk <plug>\Bbbk ' +exe s:pA14a.'P <plug>\P ' +exe s:pA14a.'S <plug>\S ' +" }}} +" {{{ Symbols2 +let s:pA14b = s:pA."&Symbols2." +exe s:pA14b.'# <plug>\# ' +exe s:pA14b.'% <plug>\% ' +exe s:pA14b.'_ <plug>\_ ' +exe s:pA14b.'$ <plug>\$ ' +exe s:pA14b.'& <plug>\& ' +exe s:pA14b.'imath <plug>\imath ' +exe s:pA14b.'jmath <plug>\jmath ' +exe s:pA14b.'ell <plug>\ell ' +exe s:pA14b.'wp <plug>\wp ' +exe s:pA14b.'Re <plug>\Re ' +exe s:pA14b.'Im <plug>\Im ' +exe s:pA14b.'prime <plug>\prime ' +exe s:pA14b.'backprime <plug>\backprime ' +exe s:pA14b.'nabla <plug>\nabla ' +exe s:pA14b.'surd <plug>\surd ' +exe s:pA14b.'flat <plug>\flat ' +exe s:pA14b.'sharp <plug>\sharp ' +exe s:pA14b.'natural <plug>\natural ' +exe s:pA14b.'eth <plug>\eth ' +exe s:pA14b.'bigstar <plug>\bigstar ' +exe s:pA14b.'circledS <plug>\circledS ' +exe s:pA14b.'Finv <plug>\Finv ' +exe s:pA14b.'dag <plug>\dag ' +exe s:pA14b.'ddag <plug>\ddag ' +" }}} +" {{{ Symbols3 +let s:pA14c = s:pA."&Symbols3." +exe s:pA14c.'angle <plug>\angle ' +exe s:pA14c.'measuredangle <plug>\measuredangle ' +exe s:pA14c.'sphericalangle <plug>\sphericalangle ' +exe s:pA14c.'spadesuit <plug>\spadesuit ' +exe s:pA14c.'heartsuit <plug>\heartsuit ' +exe s:pA14c.'diamondsuit <plug>\diamondsuit ' +exe s:pA14c.'clubsuit <plug>\clubsuit ' +exe s:pA14c.'lozenge <plug>\lozenge ' +exe s:pA14c.'blacklozenge <plug>\blacklozenge ' +exe s:pA14c.'Diamond <plug>\Diamond ' +exe s:pA14c.'triangle <plug>\triangle ' +exe s:pA14c.'vartriangle <plug>\vartriangle ' +exe s:pA14c.'blacktriangle <plug>\blacktriangle ' +exe s:pA14c.'triangledown <plug>\triangledown ' +exe s:pA14c.'blacktriangledown <plug>\blacktriangledown ' +exe s:pA14c.'Box <plug>\Box ' +exe s:pA14c.'square <plug>\square ' +exe s:pA14c.'blacksquare <plug>\blacksquare ' +exe s:pA14c.'complement <plug>\complement ' +exe s:pA14c.'mho <plug>\mho ' +exe s:pA14c.'Game <plug>\Game ' +exe s:pA14c.'partial<Tab>`6 <plug>\partial ' +exe s:pA14c.'smallint <plug>\smallint ' +" }}} +" {{{ Logic +let s:pA15 = s:pA."&Logic." +exe s:pA15.'lnot <plug>\lnot ' +exe s:pA15.'lor <plug>\lor ' +exe s:pA15.'land <plug>\land ' +" }}} +" {{{ Limits1 +let s:pA16 = s:pA."&Limits1." +exe s:pA16.'left <plug>\left' +exe s:pA16.'right <plug>\right' +exe s:pA16.'-sepbigl- :' +exe s:pA16.'bigl <plug>\bigl' +exe s:pA16.'Bigl <plug>\Bigl' +exe s:pA16.'biggl <plug>\biggl' +exe s:pA16.'Biggl <plug>\Biggl' +exe s:pA16.'-sepbigr- :' +exe s:pA16.'bigr <plug>\bigr' +exe s:pA16.'Bigr <plug>\Bigr' +exe s:pA16.'biggr <plug>\biggr' +exe s:pA16.'Biggr <plug>\Biggr' +exe s:pA16.'-sepbig- :' +exe s:pA16.'big <plug>\big' +exe s:pA16.'bigm <plug>\bigm' +exe s:pA16.'-sepfloor- :' +exe s:pA16.'lfloor <plug>\lfloor ' +exe s:pA16.'lceil <plug>\lceil ' +exe s:pA16.'rfloor <plug>\rfloor ' +exe s:pA16.'rceil <plug>\rceil ' +exe s:pA16.'-sepangle- :' +exe s:pA16.'langle <plug>\langle ' +exe s:pA16.'rangle <plug>\rangle ' +" }}} +" {{{ Limits2 +let s:pA16a = s:pA."&Limits2." +exe s:pA16a.'ulcorner <plug>\ulcorner ' +exe s:pA16a.'urcorner <plug>\urcorner ' +exe s:pA16a.'llcorner <plug>\llcorner ' +exe s:pA16a.'rlcorner <plug>\rlcorner ' +exe s:pA16a.'-sepcorner- :' +exe s:pA16a.'vert <plug>\vert ' +exe s:pA16a.'Vert <plug>\Vert ' +exe s:pA16a.'lvert <plug>\lvert ' +exe s:pA16a.'lVert <plug>\lVert ' +exe s:pA16a.'rvert <plug>\rvert ' +exe s:pA16a.'rVert <plug>\rVert ' +exe s:pA16a.'uparrow <plug>\uparrow ' +exe s:pA16a.'Uparrow <plug>\Uparrow ' +exe s:pA16a.'downarrow <plug>\downarrow ' +exe s:pA16a.'Downarrow <plug>\Downarrow ' +exe s:pA16a.'updownarrow <plug>\updownarrow ' +exe s:pA16a.'Updownarrow <plug>\Updownarrow ' +exe s:pA16a.'lgroup <plug>\lgroup ' +exe s:pA16a.'rgroup <plug>\rgroup ' +exe s:pA16a.'lmoustache <plug>\lmoustache ' +exe s:pA16a.'rmoustache <plug>\rmoustache ' +exe s:pA16a.'arrowvert <plug>\arrowvert ' +exe s:pA16a.'Arrowvert <plug>\Arrowvert ' +exe s:pA16a.'bracevert <plug>\bracevert ' +" }}} +" {{{ Log-likes +let s:pA17 = s:pA."Lo&g-likes." +exe s:pA17.'arccos <plug>\arccos ' +exe s:pA17.'arcsin <plug>\arcsin ' +exe s:pA17.'arctan <plug>\arctan ' +exe s:pA17.'arg <plug>\arg ' +exe s:pA17.'cos <plug>\cos ' +exe s:pA17.'cosh <plug>\cosh ' +exe s:pA17.'cot <plug>\cot ' +exe s:pA17.'coth <plug>\coth ' +exe s:pA17.'csc <plug>\csc ' +exe s:pA17.'deg <plug>\deg ' +exe s:pA17.'det <plug>\det ' +exe s:pA17.'dim <plug>\dim ' +exe s:pA17.'exp <plug>\exp ' +exe s:pA17.'gcd <plug>\gcd ' +exe s:pA17.'hom <plug>\hom ' +exe s:pA17.'inf <plug>\inf ' +exe s:pA17.'injlim <plug>\injlim ' +exe s:pA17.'ker <plug>\ker ' +exe s:pA17.'lg <plug>\lg ' +exe s:pA17.'lim <plug>\lim ' +exe s:pA17.'liminf <plug>\liminf ' +exe s:pA17.'limsup <plug>\limsup ' +exe s:pA17.'ln <plug>\ln ' +exe s:pA17.'log <plug>\log ' +exe s:pA17.'max <plug>\max ' +exe s:pA17.'min <plug>\min ' +exe s:pA17.'Pr <plug>\Pr ' +exe s:pA17.'projlim <plug>\projlim ' +exe s:pA17.'sec <plug>\sec ' +exe s:pA17.'sin <plug>\sin ' +exe s:pA17.'sinh <plug>\sinh ' +exe s:pA17.'sup <plug>\sup ' +exe s:pA17.'tan <plug>\tan ' +exe s:pA17.'tanh <plug>\tanh ' +exe s:pA17.'varlimsup <plug>\varlimsup ' +exe s:pA17.'varliminf <plug>\varliminf ' +exe s:pA17.'varinjlim <plug>\varinjlim ' +exe s:pA17.'varprojlim <plug>\varprojlim ' +" }}} +" {{{ MathSpacing +let s:pA18 = s:pA."MathSpacing." +exe s:pA18.', <plug>\, ' +exe s:pA18.': <plug>\: ' +exe s:pA18.'; <plug>\; ' +exe s:pA18.'[space] <plug>\ ' +exe s:pA18.'quad <plug>\quad ' +exe s:pA18.'qquad <plug>\qquad ' +exe s:pA18.'! <plug>\! ' +exe s:pA18.'thinspace <plug>\thinspace ' +exe s:pA18.'medspace <plug>\medspace ' +exe s:pA18.'thickspace <plug>\thickspace ' +exe s:pA18.'negthinspace <plug>\negthinspace ' +exe s:pA18.'negmedspace <plug>\negmedspace ' +exe s:pA18.'negthickspace <plug>\negthickspace ' +" 1}}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/multicompile.vim b/vim-latex/ftplugin/latex-suite/multicompile.vim new file mode 100644 index 0000000..2e74762 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/multicompile.vim @@ -0,0 +1,16 @@ +" ============================================================================ +" File: multicompile.vim +" Author: Srinath Avadhanula +" Created: Sat Jul 05 03:00 PM 2003 +" Description: compile a .tex file multiple times to get cross references +" right. +" License: Vim Charityware License +" Part of vim-latexSuite: http://vim-latex.sourceforge.net +" ============================================================================ + +" The contents of this file have been moved to compiler.vim, the file which +" contains all functions relevant to compiling and viewing. +" This file is kept empty on purpose so that it will over-write previous +" versions of multicompile.vim, therby preventing conflicts. + +" vim:fdm=marker:nowrap:noet:ff=unix:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/outline.py b/vim-latex/ftplugin/latex-suite/outline.py new file mode 100755 index 0000000..d8dc90f --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/outline.py @@ -0,0 +1,194 @@ +#!/usr/bin/python + +# Part of Latex-Suite +# +# Copyright: Srinath Avadhanula +# Description: +# This file implements a simple outline creation for latex documents. + +import re +import os +import sys +import StringIO + +# getFileContents {{{ +def getFileContents(fname): + if type(fname) is not str: + fname = fname.group(3) + + # If neither the file or file.tex exists, then we just give up. + if not os.path.isfile(fname): + if os.path.isfile(fname + '.tex'): + fname += '.tex' + else: + return '' + + try: + # This longish thing is to make sure that all files are converted into + # \n seperated lines. + contents = '\n'.join(open(fname).read().splitlines()) + except IOError: + return '' + + # TODO what are all the ways in which a tex file can include another? + pat = re.compile(r'^\\(@?)(include|input){(.*?)}', re.M) + contents = re.sub(pat, getFileContents, contents) + + return ('%%==== FILENAME: %s' % fname) + '\n' + contents + +# }}} +# stripComments {{{ +def stripComments(contents): + # remove all comments except those of the form + # %%==== FILENAME: <filename.tex> + # BUG: This comment right after a new paragraph is not recognized: foo\\%comment + uncomm = [re.sub('(?<!\\\\)%(?!==== FILENAME: ).*', '', line) for line in contents.splitlines()] + # also remove all only-whitespace lines. + nonempty = [line for line in uncomm if line.strip()] + + return nonempty +# }}} +# addFileNameAndNumber {{{ +def addFileNameAndNumber(lines): + filename = '' + retval = '' + for line in lines: + if re.match('%==== FILENAME: ', line): + filename = line.split('%==== FILENAME: ')[1] + else: + retval += '<%s>%s\n' % (filename, line) + + return retval +# }}} +# getSectionLabels_Root {{{ +def getSectionLabels_Root(lineinfo, section_prefix, label_prefix): + prev_txt = '' + inside_env = 0 + prev_env = '' + outstr = StringIO.StringIO('') + pres_depth = len(section_prefix) + + #print '+getSectionLabels_Root: lineinfo = [%s]' % lineinfo + for line in lineinfo.splitlines(): + if not line: + continue + + # throw away leading white-space + m = re.search('<(.*?)>(.*)', line) + + fname = m.group(1) + line = m.group(2).lstrip() + + # we found a label! + m = re.search(r'\\label{(%s.*?)}' % label_prefix, line) + if m: + # add the current line (except the \label command) to the text + # which will be displayed below this label + prev_txt += re.search(r'(^.*?)\\label{', line).group(1) + + # for the figure environment however, just display the caption. + # instead of everything since the \begin command. + if prev_env == 'figure': + cm = re.search(r'\caption(\[.*?\]\s*)?{(.*?)}', prev_txt) + if cm: + prev_txt = cm.group(2) + + # print a nice formatted text entry like so + # + # > eqn:label + # : e^{i\pi} + 1 = 0 + # + # Use the current "section depth" for the leading indentation. + print >>outstr, '>%s%s\t\t<%s>' % (' '*(2*pres_depth+2), + m.group(1), fname) + print >>outstr, ':%s%s' % (' '*(2*pres_depth+4), prev_txt) + prev_txt = '' + + # If we just encoutered the start or end of an environment or a + # label, then do not remember this line. + # NOTE: This assumes that there is no equation text on the same + # line as the \begin or \end command. The text on the same line as + # the \label was already handled. + if re.search(r'\\begin{(equation|eqnarray|align|figure)', line): + prev_txt = '' + prev_env = re.search(r'\\begin{(.*?)}', line).group(1) + inside_env = 1 + + elif re.search(r'\\label', line): + prev_txt = '' + + elif re.search(r'\\end{(equation|eqnarray|align|figure)', line): + inside_env = 0 + prev_env = '' + + else: + # If we are inside an environment, then the text displayed with + # the label is the complete text within the environment, + # otherwise its just the previous line. + if inside_env: + prev_txt += line + else: + prev_txt = line + + return outstr.getvalue() + +# }}} +# getSectionLabels {{{ +def getSectionLabels(lineinfo, + sectypes=['chapter', 'section', 'subsection', 'subsubsection'], + section_prefix='', label_prefix=''): + + if not sectypes: + return getSectionLabels_Root(lineinfo, section_prefix, label_prefix) + + ##print 'sectypes[0] = %s, section_prefix = [%s], lineinfo = [%s]' % ( + ## sectypes[0], section_prefix, lineinfo) + + sections = re.split(r'(<.*?>\\%s{.*})' % sectypes[0], lineinfo) + + # there will 1+2n sections, the first containing the "preamble" and the + # others containing the child sections as paris of [section_name, + # section_text] + + rettext = getSectionLabels(sections[0], sectypes[1:], section_prefix, label_prefix) + + for i in range(1,len(sections),2): + sec_num = (i+1)/2 + section_name = re.search(r'\\%s{(.*?)}' % sectypes[0], sections[i]).group(1) + section_label_text = getSectionLabels(sections[i] + sections[i+1], sectypes[1:], + section_prefix+('%d.' % sec_num), label_prefix) + + if section_label_text: + sec_heading = 2*' '*len(section_prefix) + section_prefix + sec_heading += '%d. %s' % (sec_num, section_name) + sec_heading += '<<<%d\n' % (len(section_prefix)/2+1) + + rettext += sec_heading + section_label_text + + return rettext + +# }}} + +# main {{{ +def main(fname, label_prefix): + [head, tail] = os.path.split(fname) + if head: + os.chdir(head) + + contents = getFileContents(fname) + nonempty = stripComments(contents) + lineinfo = addFileNameAndNumber(nonempty) + + return getSectionLabels(lineinfo, label_prefix=label_prefix) +# }}} + +if __name__ == "__main__": + if len(sys.argv) > 2: + prefix = sys.argv[2] + else: + prefix = '' + + print main(sys.argv[1], prefix) + + +# vim: fdm=marker diff --git a/vim-latex/ftplugin/latex-suite/packages.vim b/vim-latex/ftplugin/latex-suite/packages.vim new file mode 100644 index 0000000..49b4e48 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages.vim @@ -0,0 +1,676 @@ +"============================================================================= +" File: packages.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: handling packages from within vim +"============================================================================= + +" avoid reinclusion. +if !g:Tex_PackagesMenu || exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +let s:path = fnameescape(expand("<sfile>:p:h")) + +let s:menu_div = 20 + +com! -nargs=0 TPackageUpdate :silent! call Tex_pack_updateall(1) +com! -nargs=0 TPackageUpdateAll :silent! call Tex_pack_updateall(1) + +" Custom command-line completion of Tcommands is very useful but this feature +" is available only in Vim 6.2 and above. Check number of version and choose +" proper command and function. +if v:version >= 602 + com! -complete=custom,Tex_CompletePackageName -nargs=* TPackage let s:retVal = Tex_pack_one(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + + " Tex_CompletePackageName: for completing names in TPackage command {{{ + " Description: get list of package names with globpath(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompletePackageName(A,P,L) + " Get name of packages from all runtimepath directories + let packnames = Tex_FindInRtp('', 'packages') + let packnames = substitute(packnames, '^,', '', 'e') + " Separate names with \n not , + let packnames = substitute(packnames,',','\n','g') + return packnames + endfunction + " }}} + +else + com! -nargs=* TPackage let s:retVal = Tex_pack_one(<f-args>) <bar> normal! i<C-r>=s:retVal<CR> + +endif + +imap <silent> <plug> <Nop> +nmap <silent> <plug> i + +let g:Tex_package_supported = '' +let g:Tex_package_detected = '' +" Remember the defaults because we want g:Tex_PromptedEnvironments to contain +" in addition to the default, \newenvironments, and the \newenvironments might +" change... +let g:Tex_PromptedEnvironmentsDefault = g:Tex_PromptedEnvironments +let g:Tex_PromptedCommandsDefault = g:Tex_PromptedCommands + + +" Tex_pack_check: creates the package menu and adds to 'dict' setting. {{{ +" +function! Tex_pack_check(package) + " Use Tex_FindInRtp() function to get first name from packages list in all + " rtp directories conforming with latex-suite directories hierarchy + " Store names in variables to process functions only once. + let packname = Tex_FindInRtp(a:package, 'packages') + if packname != '' + exe 'runtime! ftplugin/latex-suite/packages/' . a:package + if has("gui_running") + call Tex_pack(a:package) + endif + if g:Tex_package_supported !~ a:package + let g:Tex_package_supported = g:Tex_package_supported.','.a:package + endif + endif + " Return full list of dictionaries (separated with ,) for package in &rtp + call Tex_Debug("Tex_pack_check: searching for ".a:package." in dictionaries/ in &rtp", "pack") + let dictname = Tex_FindInRtp(a:package, 'dictionaries', ':p') + if dictname != '' + exe 'setlocal dict^=' . dictname + call Tex_Debug('Tex_pack_check: setlocal dict^=' . dictname, 'pack') + if g:Tex_package_supported !~ a:package + let g:Tex_package_supported = g:Tex_package_supported.','.a:package + endif + endif + if g:Tex_package_detected !~ '\<'.a:package.'\>' + let g:Tex_package_detected = g:Tex_package_detected.','.a:package + endif + let g:Tex_package_detected = substitute(g:Tex_package_detected, '^,', '', '') + let g:Tex_package_supported = substitute(g:Tex_package_supported, '^,', '', '') +endfunction + +" }}} +" Tex_pack_uncheck: removes package from menu and 'dict' settings. {{{ +function! Tex_pack_uncheck(package) + if has("gui_running") && Tex_FindInRtp(a:package, 'packages') != '' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.'-sep'.a:package.'-' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Options' + exe 'silent! aunmenu '.g:Tex_PackagesMenuLocation.a:package.'\ Commands' + endif + if Tex_FindInRtp(a:package, 'dictionaries') != '' + exe 'setlocal dict-='.Tex_FindInRtp(a:package, 'dictionaries') + endif +endfunction + +" }}} +" Tex_pack_updateall: updates the TeX-Packages menu {{{ +" Description: +" This function first calls Tex_pack_all to scan for \usepackage's etc if +" necessary. After that, it 'supports' and 'unsupports' packages as needed +" in such a way as to not repeat work. +function! Tex_pack_updateall(force) + call Tex_Debug('+Tex_pack_updateall', 'pack') + + " Find out which file we need to scan. + let fname = Tex_GetMainFileName(':p') + + " If this is the same as last time, don't repeat. + if !a:force && exists('s:lastScannedFile') && + \ s:lastScannedFile == fname + return + endif + " Remember which file we scanned for next time. + let s:lastScannedFile = fname + + " Remember which packages we detected last time. + if exists('g:Tex_package_detected') + let oldpackages = g:Tex_package_detected + else + let oldpackages = '' + endif + + " This sets up a global variable of all detected packages. + let g:Tex_package_detected = '' + " reset the environments and commands. + let g:Tex_PromptedEnvironments = g:Tex_PromptedEnvironmentsDefault + let g:Tex_PromptedCommands = g:Tex_PromptedCommandsDefault + + if expand('%:p') != fname + call Tex_Debug(':Tex_pack_updateall: sview '.Tex_EscapeSpaces(fname), 'pack') + exe 'sview '.Tex_EscapeSpaces(fname) + else + call Tex_Debug(':Tex_pack_updateall: split', 'pack') + split + endif + + call Tex_ScanForPackages() + q + + call Tex_Debug(':Tex_pack_updateall: detected ['.g:Tex_package_detected.'] in first run', 'pack') + + " Now for each package find out if this is a custom package and if so, + " scan that as well. We will use the ':find' command in vim to let vim + " search through the file paths for us. + " + " NOTE: This while loop will also take into account packages included + " within packages to any level of recursion as long as + " g:Tex_package_detected is always padded with new package names + " from the end. + " + " First set the &path setting to the user's TEXINPUTS setting. + let _path = &path + let _suffixesadd = &suffixesadd + + let &path = '.,'.g:Tex_TEXINPUTS + let &suffixesadd = '.sty,.tex' + + let scannedPackages = '' + + let i = 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + while packname != '' + + call Tex_Debug(':Tex_pack_updateall: scanning package '.packname, 'pack') + + " Scan this package only if we have not scanned it before in this + " run. + if scannedPackages =~ '\<'.packname.'\>' + let i = i + 1 + + call Tex_Debug(':Tex_pack_updateall: '.packname.' already scanned', 'pack') + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + continue + endif + + " Split this window in two. The packages/files being found will open + " in this new window and we also need not bother with files being + " modified etc. + split + + call Tex_Debug(':Tex_pack_updateall: silent! find '.Tex_EscapeSpaces(packname).'.sty', 'pack') + let thisbufnum = bufnr('%') + exec 'silent! find '.Tex_EscapeSpaces(packname).'.sty' + call Tex_Debug(':Tex_pack_updateall: present file = '.bufname('%'), 'pack') + + " If this file was not found, assume that it means its not a + " custom package and mark it "scanned". + " A package is not found if we stay in the same buffer as before and + " its not the one where we want to go. + if bufnr('%') == thisbufnum && bufnr('%') != bufnr(packname.'.sty') + let scannedPackages = scannedPackages.','.packname + q + + call Tex_Debug(':Tex_pack_updateall: '.packname.' not found anywhere', 'pack') + let i = i + 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + continue + endif + + " otherwise we are presently editing a custom package, scan it for + " more \usepackage lines from the first line to the last. + let packpath = expand('%:p') + let &complete = &complete.'s'.packpath + + call Tex_Debug(':Tex_pack_updateall: found custom package '.packpath, 'pack') + call Tex_ScanForPackages(line('$'), line('$')) + call Tex_Debug(':Tex_pack_updateall: After scanning, g:Tex_package_detected = '.g:Tex_package_detected, 'pack') + + let scannedPackages = scannedPackages.','.packname + " Do not use bwipe, but that leads to excessive buffer number + " consumption. Besides, its intuitive for a custom package to remain + " on the buffer list. + q + + let i = i + 1 + let packname = Tex_Strntok(g:Tex_package_detected, ',', i) + endwhile + + let &path = _path + let &suffixesadd = _suffixesadd + + " Now only support packages we didn't last time. + " First remove packages which were used last time but are no longer used. + let i = 1 + let oldPackName = Tex_Strntok(oldpackages, ',', i) + while oldPackName != '' + if g:Tex_package_detected !~ oldPackName + call Tex_pack_uncheck(oldPackName) + endif + let i = i + 1 + let oldPackName = Tex_Strntok(oldpackages, ',', i) + endwhile + + " Then support packages which are used this time but weren't used last + " time. + let i = 1 + let newPackName = Tex_Strntok(g:Tex_package_detected, ',', i) + while newPackName != '' + if oldpackages !~ newPackName + call Tex_pack_one(newPackName) + endif + let i = i + 1 + let newPackName = Tex_Strntok(g:Tex_package_detected, ',', i) + endwhile + + " Throw an event that we are done scanning packages. Some packages might + " use this to change behavior based on which options have been used etc. + call Tex_Debug(":Tex_pack_updateall: throwing LatexSuiteScannedPackages event", "pack") + silent! do LatexSuite User LatexSuiteScannedPackages + + call Tex_Debug("-Tex_pack_updateall", "pack") +endfunction + +" }}} +" Tex_pack_one: supports each package in the argument list.{{{ +" Description: +" If no arguments are supplied, then the user is asked to choose from the +" packages found in the packages/ directory +function! Tex_pack_one(...) + if a:0 == 0 || (a:0 > 0 && a:1 == '') + let packlist = Tex_FindInRtp('', 'packages') + let packname = Tex_ChooseFromPrompt( + \ "Choose a package: \n" . + \ Tex_CreatePrompt(packlist, '3', ',') . + \ "\nEnter number or filename :", + \ packlist, ',') + if packname != '' + return Tex_pack_one(packname) + else + return '' + endif + else + " Support the packages supplied. This function can be called with + " multiple arguments in which case, support each of them in turn. + let retVal = '' + let omega = 1 + while omega <= a:0 + let packname = a:{omega} + if Tex_FindInRtp(packname, 'packages') != '' + call Tex_pack_check(packname) + if exists('g:TeX_package_option_'.packname) + \ && g:TeX_package_option_{packname} != '' + let retVal = retVal.'\usepackage[<++>]{'.packname.'}<++>' + else + let retVal = retVal.'\usepackage{'.packname.'}'."\<CR>" + endif + else + let retVal = retVal.'\usepackage{'.packname.'}'."\<CR>" + endif + let omega = omega + 1 + endwhile + return IMAP_PutTextWithMovement(substitute(retVal, "\<CR>$", '', ''), '<+', '+>') + endif +endfunction +" }}} +" Tex_ScanForPackages: scans the current file for \usepackage{} lines {{{ +" and if supported, loads the options and commands found in the +" corresponding package file. Also scans for \newenvironment and +" \newcommand lines and adds names to g:Tex_Prompted variables, they can be +" easy available through <F5> and <F7> shortcuts +function! Tex_ScanForPackages(...) + call Tex_Debug("+Tex_ScanForPackages", "pack") + + let pos = Tex_GetPos() + + " For package files without \begin and \end{document}, we might be told to + " search from beginning to end. + if a:0 < 2 + 0 + let beginline = search('\\begin{document}', 'W') + let endline = search('\\end{document}', 'W') + 0 + else + let beginline = a:1 + let endline = a:2 + endif + + call Tex_Debug(":Tex_ScanForPackages: Begining scans in [".bufname('%')."], beginline = ".beginline, "pack") + + + " Scan the file. First open up all the folds, because the command + " /somepattern + " issued in a closed fold _always_ goes to the first match. + let erm = v:errmsg + silent! normal! ggVGzO + let v:errmsg = erm + + call Tex_Debug(":Tex_ScanForPackages: beginning scan for \\usepackage lines", "pack") + " The wrap trick enables us to match \usepackage on the first line as + " well. + let wrap = 'w' + while search('^\s*\\usepackage\_.\{-}{\_.\+}', wrap) + let wrap = 'W' + + if line('.') > beginline + break + endif + + let saveUnnamed = @" + let saveA = @a + + " If there are options, then find those. + if getline('.') =~ '\\usepackage\[.\{-}\]' + let options = matchstr(getline('.'), '\\usepackage\[\zs.\{-}\ze\]') + elseif getline('.') =~ '\\usepackage\[' + " Entering here means that the user has split the \usepackage + " across newlines. Therefore, use yank. + exec "normal! /{\<CR>\"ayi}" + let options = @a + else + let options = '' + endif + + " The following statement puts the stuff between the { }'s of a + " \usepackage{stuff,foo} into @a. Do not use matchstr() and the like + " because we can have things split across lines and such. + exec "normal! /{\<CR>\"ay/}\<CR>" + + " now remove all whitespace from @a. We need to remove \n and \r + " because we can encounter stuff like + " \usepackage{pack1, + " newpackonanotherline} + let @a = substitute(@a, "[ \t\n\r]", '', 'g') + + " Now we have something like pack1,pack2,pack3 with possibly commas + " and stuff before the first package and after the last package name. + " Remove those. + let @a = substitute(@a, '\(^\W*\|\W*$\)', '', 'g') + + " This gets us a string like 'pack1,pack2,pack3' + " TODO: This will contain duplicates if the user has duplicates. + " Should we bother taking care of this? + let g:Tex_package_detected = g:Tex_package_detected.','.@a + + " For each package found, form a global variable of the form + " g:Tex_{packagename}_options + " which contains a list of the options. + let j = 1 + while Tex_Strntok(@a, ',', j) != '' + let g:Tex_{Tex_Strntok(@a, ',', j)}_options = options + let j = j + 1 + endwhile + + " Finally convert @a into something like '"pack1","pack2"' + let @a = substitute(@a, '^\|$', '"', 'g') + let @a = substitute(@a, ',', '","', 'g') + + call Tex_Debug(":Tex_ScanForPackages: found package(s) [".@a."] on line ".line('.'), "pack") + + " restore @a + let @a = saveA + let @" = saveUnnamed + endwhile + call Tex_Debug(":Tex_ScanForPackages: End scan \\usepackage, detected packages = ".g:Tex_package_detected, "pack") + + " TODO: This needs to be changed. In the future, we might have + " functionality to remember the fold-state before opening up all the folds + " and then re-creating them. Use mkview.vim. + let erm = v:errmsg + silent! normal! ggVGzC + let v:errmsg = erm + + " Because creating list of detected packages gives string + " ',pack1,pack2,pack3' remove leading , + let g:Tex_package_detected = substitute(g:Tex_package_detected, '^,', '', '') + + call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newcommand's", "pack") + " Scans whole file (up to \end{document}) for \newcommand and adds this + " commands to g:Tex_PromptedCommands variable, it is easily available + " through <F7> + 0 + while search('^\s*\\newcommand\*\?{.\{-}}', 'W') + + if line('.') > endline + break + endif + + let newcommand = matchstr(getline('.'), '\\newcommand\*\?{\\\zs.\{-}\ze}') + let g:Tex_PromptedCommands = g:Tex_PromptedCommands . ',' . newcommand + + endwhile + + " Scans whole file (up to \end{document}) for \newenvironment and adds this + " environments to g:Tex_PromptedEnvironments variable, it is easily available + " through <F5> + 0 + call Tex_Debug(":Tex_ScanForPackages: Beginning scan for \\newenvironment's", 'pack') + + while search('^\s*\\newenvironment\*\?{.\{-}}', 'W') + call Tex_Debug('found newenvironment on '.line('.'), 'pack') + + if line('.') > endline + break + endif + + let newenvironment = matchstr(getline('.'), '\\newenvironment\*\?{\zs.\{-}\ze}') + let g:Tex_PromptedEnvironments = g:Tex_PromptedEnvironments . ',' . newenvironment + + endwhile + + call Tex_SetPos(pos) + " first make a random search so that we push at least one item onto the + " search history. Since vim puts only one item in the history per function + " call, this way we make sure that one and only item is put into the + " search history. + normal! /^<CR> + " now delete it... + call histdel('/', -1) + + call Tex_Debug("-Tex_ScanForPackages", "pack") +endfunction + +" }}} +" Tex_pack_supp_menu: sets up a menu for package files {{{ +" found in the packages directory groups the packages thus found into groups +" of 20... +function! Tex_pack_supp_menu() + let suplist = Tex_FindInRtp('', 'packages') + + call Tex_MakeSubmenu(suplist, g:Tex_PackagesMenuLocation.'Supported.', + \ '<plug><C-r>=Tex_pack_one("', '")<CR>') +endfunction + +" }}} +" Tex_pack: loads the options (and commands) for the given package {{{ +function! Tex_pack(pack) + if exists('g:TeX_package_'.a:pack) + + let optionList = g:TeX_package_option_{a:pack}.',' + let commandList = g:TeX_package_{a:pack}.',' + + " Don't create separator if in package file are only Vim commands. + " Rare but possible. + if !(commandList == ',' && optionList == ',') + exec 'amenu '.g:Tex_PackagesMenuLocation.'-sep'.a:pack.'- <Nop>' + endif + + if optionList != '' + + let mainMenuName = g:Tex_PackagesMenuLocation.a:pack.'\ Options.' + call s:GroupPackageMenuItems(optionList, mainMenuName, + \ '<plug><C-r>=IMAP_PutTextWithMovement("', ',")<CR>') + + endif + + if commandList != '' + + let mainMenuName = g:Tex_PackagesMenuLocation.a:pack.'\ Commands.' + call s:GroupPackageMenuItems(commandList, mainMenuName, + \ '<plug><C-r>=Tex_ProcessPackageCommand("', '")<CR>', + \ '<SID>FilterPackageMenuLHS') + endif + endif +endfunction + +" }}} + +" ============================================================================== +" Menu Functions +" Creating menu items for the all the package files found in the packages/ +" directory as well as creating menus for each supported package found in the +" preamble. +" ============================================================================== +" Tex_MakeSubmenu: makes a submenu given a list of items {{{ +" Description: +" This function takes a comma seperated list of menu items and creates a +" 'grouped' menu. i.e, it groups the items into s:menu_div items each and +" puts them in submenus of the given mainMenu. +" Each menu item is linked to the HandlerFunc. +" If an additional argument is supplied, then it is used to filter each of +" the menu items to generate better names for the menu display. +" +function! Tex_MakeSubmenu(menuList, mainMenuName, + \ handlerFuncLHS, handlerFuncRHS, ...) + + let extractFunction = (a:0 > 0 ? a:1 : '' ) + let menuList = substitute(a:menuList, '[^,]$', ',', '') + + let doneMenuSubmenu = 0 + + while menuList != '' + + " Extract upto s:menu_div menus at once. + let menuBunch = matchstr(menuList, '\v(.{-},){,'.s:menu_div.'}') + + " The remaining menus go into the list. + let menuList = strpart(menuList, strlen(menuBunch)) + + let submenu = '' + " If there is something remaining, then we got s:menu_div items. + " therefore put these menu items into a submenu. + if strlen(menuList) || doneMenuSubmenu + exec 'let firstMenu = '.extractFunction."(matchstr(menuBunch, '\\v^.{-}\\ze,'))" + exec 'let lastMenu = '.extractFunction."(matchstr(menuBunch, '\\v[^,]{-}\\ze,$'))" + + let submenu = firstMenu.'\ \-\ '.lastMenu.'.' + + let doneMenuSubmenu = 1 + endif + + " Now for each menu create a menu under the submenu + let i = 1 + let menuName = Tex_Strntok(menuBunch, ',', i) + while menuName != '' + exec 'let menuItem = '.extractFunction.'(menuName)' + execute 'amenu '.a:mainMenuName.submenu.menuItem + \ ' '.a:handlerFuncLHS.menuName.a:handlerFuncRHS + + let i = i + 1 + let menuName = Tex_Strntok(menuBunch, ',', i) + endwhile + endwhile +endfunction + +" }}} +" GroupPackageMenuItems: uses the sbr: to split menus into groups {{{ +" Description: +" This function first splits up the menuList into groups based on the +" special sbr: tag and then calls Tex_MakeSubmenu +" +function! <SID>GroupPackageMenuItems(menuList, menuName, + \ handlerFuncLHS, handlerFuncRHS,...) + + if a:0 > 0 + let extractFunction = a:1 + else + let extractFunction = '' + endif + let menuList = a:menuList + + while matchstr(menuList, 'sbr:') != '' + let groupName = matchstr(menuList, '\v^sbr:\zs.{-}\ze,') + let menuList = strpart(menuList, strlen('sbr:'.groupName.',')) + if matchstr(menuList, 'sbr:') != '' + let menuGroup = matchstr(menuList, '\v^.{-},\zesbr:') + else + let menuGroup = menuList + endif + + call Tex_MakeSubmenu(menuGroup, a:menuName.groupName.'.', + \ a:handlerFuncLHS, a:handlerFuncRHS, extractFunction) + + let menuList = strpart(menuList, strlen(menuGroup)) + endwhile + + call Tex_MakeSubmenu(menuList, a:menuName, + \ a:handlerFuncLHS, a:handlerFuncRHS, extractFunction) + +endfunction " }}} +" Definition of what to do for various package commands {{{ +let s:CommandSpec_brs = '\<+replace+><++>' +let s:CommandSpec_bra = '\<+replace+>{<++>}<++>' +let s:CommandSpec_brd = '\<+replace+>{<++>}{<++>}<++>' + +let s:CommandSpec_nor = '\<+replace+>' +let s:CommandSpec_noo = '\<+replace+>[<++>]' +let s:CommandSpec_nob = '\<+replace+>[<++>]{<++>}{<++>}<++>' + +let s:CommandSpec_env = '\begin{<+replace+>}'."\<CR><++>\<CR>".'\end{<+replace+>}<++>' +let s:CommandSpec_ens = '\begin{<+replace+>}<+extra+>'."\<CR><++>\<CR>".'\end{<+replace+>}<++>' +let s:CommandSpec_eno = '\begin[<++>]{<+replace+>}'."\<CR><++>\<CR>".'\end{<+replace+>}' + +let s:CommandSpec_spe = '<+replace+>' +let s:CommandSpec_ = '\<+replace+>' + +let s:MenuLHS_bra = '\\&<+replace+>{}' +let s:MenuLHS_brs = '\\&<+replace+>{}' +let s:MenuLHS_brd = '\\&<+replace+>{}{}' +let s:MenuLHS_env = '&<+replace+>\ (E)' +let s:MenuLHS_ens = '&<+replace+>\ (E)' +let s:MenuLHS_eno = '&<+replace+>\ (E)' +let s:MenuLHS_nor = '\\&<+replace+>' +let s:MenuLHS_noo = '\\&<+replace+>[]' +let s:MenuLHS_nob = '\\&<+replace+>[]{}{}' +let s:MenuLHS_spe = '&<+replace+>' +let s:MenuLHS_sep = '-sep<+replace+>-' +let s:MenuLHS_ = '\\&<+replace+>' +" }}} +" Tex_ProcessPackageCommand: processes a command from the package menu {{{ +" Description: +function! Tex_ProcessPackageCommand(command) + if a:command =~ ':' + let commandType = matchstr(a:command, '^\w\+\ze:') + let commandName = matchstr(a:command, '^\w\+:\zs[^:]\+\ze:\?') + let extrapart = strpart(a:command, strlen(commandType.':'.commandName.':')) + else + let commandType = '' + let commandName = a:command + let extrapart = '' + endif + + let command = s:CommandSpec_{commandType} + let command = substitute(command, '<+replace+>', commandName, 'g') + let command = substitute(command, '<+extra+>', extrapart, 'g') + return IMAP_PutTextWithMovement(command) +endfunction +" }}} +" FilterPackageMenuLHS: filters the command description to provide a better menu item {{{ +" Description: +function! <SID>FilterPackageMenuLHS(command) + let commandType = matchstr(a:command, '^\w\+\ze:') + if commandType != '' + let commandName = strpart(a:command, strlen(commandType.':')) + else + let commandName = a:command + endif + + return substitute(s:MenuLHS_{commandType}, '<+replace+>', commandName, 'g') +endfunction " }}} + +if g:Tex_Menus + exe 'amenu '.g:Tex_PackagesMenuLocation.'&UpdatePackage :call Tex_pack(expand("<cword>"))<cr>' + exe 'amenu '.g:Tex_PackagesMenuLocation.'&UpdateAll :call Tex_pack_updateall(1)<cr>' + + call Tex_pack_supp_menu() +endif + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('packages.vim: Catching LatexSuiteFileType event', 'pack') | + \ let s:save_clipboard = &clipboard | + \ set clipboard= | + \ call Tex_pack_updateall(0) | + \ let &clipboard=s:save_clipboard +augroup END + +" vim:fdm=marker:ts=4:sw=4:noet:ff=unix diff --git a/vim-latex/ftplugin/latex-suite/packages/SIunits b/vim-latex/ftplugin/latex-suite/packages/SIunits new file mode 100644 index 0000000..ba110fa --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/SIunits @@ -0,0 +1,315 @@ +if exists("SIunits_package_file") + finish +endif +let SIunits_package_file = 1 + +let g:TeX_package_SIunits = +\'nor:addprefix,'. +\'nor:addunit,'. +\'nor:ampere,'. +\'nor:amperemetresecond,'. +\'nor:amperepermetre,'. +\'nor:amperepermetrenp,'. +\'nor:amperepersquaremetre,'. +\'nor:amperepersquaremetrenp,'. +\'nor:angstrom,'. +\'nor:arad,'. +\'nor:arcminute,'. +\'nor:arcsecond,'. +\'nor:are,'. +\'nor:atomicmass,'. +\'nor:atto,'. +\'nor:attod,'. +\'nor:barn,'. +\'nor:bbar,'. +\'nor:becquerel,'. +\'nor:becquerelbase,'. +\'nor:bel,'. +\'nor:candela,'. +\'nor:candelapersquaremetre,'. +\'nor:candelapersquaremetrenp,'. +\'nor:celsius,'. +\'nor:Celsius,'. +\'nor:celsiusbase,'. +\'nor:centi,'. +\'nor:centid,'. +\'nor:coulomb,'. +\'nor:coulombbase,'. +\'nor:coulombpercubicmetre,'. +\'nor:coulombpercubicmetrenp,'. +\'nor:coulombperkilogram,'. +\'nor:coulombperkilogramnp,'. +\'nor:coulombpermol,'. +\'nor:coulombpermolnp,'. +\'nor:coulombpersquaremetre,'. +\'nor:coulombpersquaremetrenp,'. +\'nor:cubed,'. +\'nor:cubic,'. +\'nor:cubicmetre,'. +\'nor:cubicmetreperkilogram,'. +\'nor:cubicmetrepersecond,'. +\'nor:curie,'. +\'nor:dday,'. +\'nor:deca,'. +\'nor:decad,'. +\'nor:deci,'. +\'nor:decid,'. +\'nor:degree,'. +\'nor:degreecelsius,'. +\'nor:deka,'. +\'nor:dekad,'. +\'nor:derbecquerel,'. +\'nor:dercelsius,'. +\'nor:dercoulomb,'. +\'nor:derfarad,'. +\'nor:dergray,'. +\'nor:derhenry,'. +\'nor:derhertz,'. +\'nor:derjoule,'. +\'nor:derkatal,'. +\'nor:derlumen,'. +\'nor:derlux,'. +\'nor:dernewton,'. +\'nor:derohm,'. +\'nor:derpascal,'. +\'nor:derradian,'. +\'nor:dersiemens,'. +\'nor:dersievert,'. +\'nor:dersteradian,'. +\'nor:dertesla,'. +\'nor:dervolt,'. +\'nor:derwatt,'. +\'nor:derweber,'. +\'nor:electronvolt,'. +\'nor:exa,'. +\'nor:exad,'. +\'nor:farad,'. +\'nor:faradbase,'. +\'nor:faradpermetre,'. +\'nor:faradpermetrenp,'. +\'nor:femto,'. +\'nor:femtod,'. +\'nor:fourth,'. +\'nor:gal,'. +\'nor:giga,'. +\'nor:gigad,'. +\'nor:gram,'. +\'nor:graybase,'. +\'nor:graypersecond,'. +\'nor:graypersecondnp,'. +\'nor:hectare,'. +\'nor:hecto,'. +\'nor:hectod,'. +\'nor:henry,'. +\'nor:henrybase,'. +\'nor:henrypermetre,'. +\'nor:henrypermetrenp,'. +\'nor:hertz,'. +\'nor:hertzbase,'. +\'nor:hour,'. +\'nor:joule,'. +\'nor:joulebase,'. +\'nor:joulepercubicmetre,'. +\'nor:joulepercubicmetrenp,'. +\'nor:jouleperkelvin,'. +\'nor:jouleperkelvinnp,'. +\'nor:jouleperkilogram,'. +\'nor:jouleperkilogramkelvin,'. +\'nor:jouleperkilogramkelvinnp,'. +\'nor:jouleperkilogramnp,'. +\'nor:joulepermole,'. +\'nor:joulepermolekelvin,'. +\'nor:joulepermolekelvinnp,'. +\'nor:joulepermolenp,'. +\'nor:joulepersquaremetre,'. +\'nor:joulepersquaremetrenp,'. +\'nor:joulepertesla,'. +\'nor:jouleperteslanp,'. +\'nor:katal,'. +\'nor:katalbase,'. +\'nor:katalpercubicmetre,'. +\'nor:katalpercubicmetrenp,'. +\'nor:kelvin,'. +\'nor:kilo,'. +\'nor:kilod,'. +\'nor:kilogram,'. +\'nor:kilogrammetrepersecond,'. +\'nor:kilogrammetrepersecondnp,'. +\'nor:kilogrammetrepersquaresecond,'. +\'nor:kilogrammetrepersquaresecondnp,'. +\'nor:kilogrampercubicmetre,'. +\'nor:kilogrampercubicmetrecoulomb,'. +\'nor:kilogrampercubicmetrecoulombnp,'. +\'nor:kilogrampercubicmetrenp,'. +\'nor:kilogramperkilomole,'. +\'nor:kilogramperkilomolenp,'. +\'nor:kilogrampermetre,'. +\'nor:kilogrampermetrenp,'. +\'nor:kilogrampersecond,'. +\'nor:kilogrampersecondcubicmetre,'. +\'nor:kilogrampersecondcubicmetrenp,'. +\'nor:kilogrampersecondnp,'. +\'nor:kilogrampersquaremetre,'. +\'nor:kilogrampersquaremetrenp,'. +\'nor:kilogrampersquaremetresecond,'. +\'nor:kilogrampersquaremetresecondnp,'. +\'nor:kilogramsquaremetre,'. +\'nor:kilogramsquaremetrenp,'. +\'nor:kilogramsquaremetrepersecond,'. +\'nor:kilogramsquaremetrepersecondnp,'. +\'nor:kilowatthour,'. +\'nor:liter,'. +\'nor:litre,'. +\'nor:lumen,'. +\'nor:lumenbase,'. +\'nor:lux,'. +\'nor:luxbase,'. +\'nor:mega,'. +\'nor:megad,'. +\'nor:meter,'. +\'nor:metre,'. +\'nor:metrepersecond,'. +\'nor:metrepersecondnp,'. +\'nor:metrepersquaresecond,'. +\'nor:metrepersquaresecondnp,'. +\'nor:micro,'. +\'nor:microd,'. +\'nor:milli,'. +\'nor:millid,'. +\'nor:minute,'. +\'nor:mole,'. +\'nor:molepercubicmetre,'. +\'nor:molepercubicmetrenp,'. +\'nor:nano,'. +\'nor:nanod,'. +\'nor:neper,'. +\'nor:newton,'. +\'nor:newtonbase,'. +\'nor:newtonmetre,'. +\'nor:newtonpercubicmetre,'. +\'nor:newtonpercubicmetrenp,'. +\'nor:newtonperkilogram,'. +\'nor:newtonperkilogramnp,'. +\'nor:newtonpermetre,'. +\'nor:newtonpermetrenp,'. +\'nor:newtonpersquaremetre,'. +\'nor:newtonpersquaremetrenp,'. +\'nor:NoAMS,'. +\'nor:no@qsk,'. +\'nor:ohm,'. +\'nor:ohmbase,'. +\'nor:ohmmetre,'. +\'nor:one,'. +\'nor:paminute,'. +\'nor:pascal,'. +\'nor:pascalbase,'. +\'nor:pascalsecond,'. +\'nor:pasecond,'. +\'nor:per,'. +\'nor:period@active,'. +\'nor:persquaremetresecond,'. +\'nor:persquaremetresecondnp,'. +\'nor:peta,'. +\'nor:petad,'. +\'nor:pico,'. +\'nor:picod,'. +\'nor:power,'. +\'nor:@qsk,'. +\'nor:quantityskip,'. +\'nor:rad,'. +\'nor:radian,'. +\'nor:radianbase,'. +\'nor:radianpersecond,'. +\'nor:radianpersecondnp,'. +\'nor:radianpersquaresecond,'. +\'nor:radianpersquaresecondnp,'. +\'nor:reciprocal,'. +\'nor:rem,'. +\'nor:roentgen,'. +\'nor:rp,'. +\'nor:rpcubed,'. +\'nor:rpcubic,'. +\'nor:rpcubicmetreperkilogram,'. +\'nor:rpcubicmetrepersecond,'. +\'nor:rperminute,'. +\'nor:rpersecond,'. +\'nor:rpfourth,'. +\'nor:rpsquare,'. +\'nor:rpsquared,'. +\'nor:rpsquaremetreperkilogram,'. +\'nor:second,'. +\'nor:siemens,'. +\'nor:siemensbase,'. +\'nor:sievert,'. +\'nor:sievertbase,'. +\'nor:square,'. +\'nor:squared,'. +\'nor:squaremetre,'. +\'nor:squaremetrepercubicmetre,'. +\'nor:squaremetrepercubicmetrenp,'. +\'nor:squaremetrepercubicsecond,'. +\'nor:squaremetrepercubicsecondnp,'. +\'nor:squaremetreperkilogram,'. +\'nor:squaremetrepernewtonsecond,'. +\'nor:squaremetrepernewtonsecondnp,'. +\'nor:squaremetrepersecond,'. +\'nor:squaremetrepersecondnp,'. +\'nor:squaremetrepersquaresecond,'. +\'nor:squaremetrepersquaresecondnp,'. +\'nor:steradian,'. +\'nor:steradianbase,'. +\'nor:tera,'. +\'nor:terad,'. +\'nor:tesla,'. +\'nor:teslabase,'. +\'nor:ton,'. +\'nor:tonne,'. +\'nor:unit,'. +\'nor:unitskip,'. +\'nor:usk,'. +\'nor:volt,'. +\'nor:voltbase,'. +\'nor:voltpermetre,'. +\'nor:voltpermetrenp,'. +\'nor:watt,'. +\'nor:wattbase,'. +\'nor:wattpercubicmetre,'. +\'nor:wattpercubicmetrenp,'. +\'nor:wattperkilogram,'. +\'nor:wattperkilogramnp,'. +\'nor:wattpermetrekelvin,'. +\'nor:wattpermetrekelvinnp,'. +\'nor:wattpersquaremetre,'. +\'nor:wattpersquaremetrenp,'. +\'nor:wattpersquaremetresteradian,'. +\'nor:wattpersquaremetresteradiannp,'. +\'nor:weber,'. +\'nor:weberbase,'. +\'nor:yocto,'. +\'nor:yoctod,'. +\'nor:yotta,'. +\'nor:yottad,'. +\'nor:zepto,'. +\'nor:zeptod,'. +\'nor:zetta,'. +\'nor:zettad' + +let g:TeX_package_option_SIunits = +\'amssymb,'. +\'binary,'. +\'cdot,'. +\'derived,'. +\'derivedinbase,'. +\'Gray,'. +\'mediumqspace,'. +\'mediumspace,'. +\'noams,'. +\'pstricks,'. +\'squaren,'. +\'textstyle,'. +\'thickqspace,'. +\'thickspace,'. +\'thinqspace,'. +\'thinspace' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/accents b/vim-latex/ftplugin/latex-suite/packages/accents new file mode 100644 index 0000000..706d95e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/accents @@ -0,0 +1,28 @@ +if exists("accents_package_file") + finish +endif +let accents_package_file = 1 + +let g:TeX_package_option_accents = +\ 'nonscript,' +\.'single' + +let g:TeX_package_accents = +\ 'bra:grave,' +\.'bra:acute,' +\.'bra:check,' +\.'bra:breve,' +\.'bra:bar,' +\.'bra:ring,' +\.'bra:hat,' +\.'bra:dot,' +\.'bra:tilde,' +\.'bra:undertilde,' +\.'bra:ddot,' +\.'bra:dddot,' +\.'bra:ddddot,' +\.'bra:vec,' +\.'brd:accentset,' +\.'brd:underaccent' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/acromake b/vim-latex/ftplugin/latex-suite/packages/acromake new file mode 100644 index 0000000..2130f61 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/acromake @@ -0,0 +1,10 @@ +if exists("acromake_package_file") + finish +endif +let acromake_package_file = 1 + +let g:TeX_package_option_acromake = '' + +let g:TeX_package_acromake = 'brs:acromake{<++>}{<++>}{<++>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/afterpage b/vim-latex/ftplugin/latex-suite/packages/afterpage new file mode 100644 index 0000000..5087321 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/afterpage @@ -0,0 +1,10 @@ +if exists("afterpage_package_file") + finish +endif +let afterpage_package_file = 1 + +let g:TeX_package_option_afterpage = '' + +let g:TeX_package_afterpage = 'bra:afterpage' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/alltt b/vim-latex/ftplugin/latex-suite/packages/alltt new file mode 100644 index 0000000..c30b684 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/alltt @@ -0,0 +1,12 @@ +if exists("alltt_package_file") + finish +endif +let alltt_package_file = 1 + +let g:TeX_package_option_alltt = '' + +let g:TeX_package_alltt = 'env:alltt' + +syn region texZone start="\\begin{alltt}" end="\\end{alltt}\|%stopzone\>" fold + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/amsmath b/vim-latex/ftplugin/latex-suite/packages/amsmath new file mode 100644 index 0000000..fd7dcda --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/amsmath @@ -0,0 +1,106 @@ +if exists("amsmath_package_file") + finish +endif +let amsmath_package_file = 1 + +let g:TeX_package_option_amsmath = +\ 'centertags,' +\.'tbtags,' +\.'sumlimits,' +\.'nosumlimits,' +\.'intlimits,' +\.'nointlimits,' +\.'namelimits,' +\.'nonamelimits,' +\.'leqno,' +\.'reqno,' +\.'fleqno' + +let g:TeX_package_amsmath = +\ 'sbr:Environments,' +\.'env:equation,' +\.'env:equation*,' +\.'env:align,' +\.'env:align*,' +\.'env:gather,' +\.'env:gather*,' +\.'env:flalign,' +\.'env:flalign*,' +\.'env:multline,' +\.'env:multline*,' +\.'ens:alignat:{<+arg1+>}{<+arg2+>},' +\.'env:alignat,' +\.'ens:alignat*:{<+arg1+>}{<+arg2+>},,' +\.'env:alignat*,' +\.'env:subequations,' +\.'env:subarray,' +\.'env:split,' +\.'env:cases,' +\.'sbr:Matrices,' +\.'env:matrix,' +\.'env:pmatrix,' +\.'env:bmatrix,' +\.'env:Bmatrix,' +\.'env:vmatrix,' +\.'env:Vmatrix,' +\.'env:smallmatrix,' +\.'bra:hdotsfor,' +\.'sbr:Dots,' +\.'dotsc,' +\.'dotsb,' +\.'dotsm,' +\.'dotsi,' +\.'dotso,' +\.'sbr:ItalicGreek,' +\.'nor:varGamma,' +\.'nor:varDelta,' +\.'nor:varTheta,' +\.'nor:varLambda,' +\.'nor:varXi,' +\.'nor:varPi,' +\.'nor:varSigma,' +\.'nor:varUpsilon,' +\.'nor:varPhi,' +\.'nor:varPsi,' +\.'nor:varOmega,' +\.'sbr:Mod,' +\.'nor:mod,' +\.'nor:bmod,' +\.'nor:pmod,' +\.'nor:pod,' +\.'sbr:CreatingSymbols,' +\.'brd:overset,' +\.'brd:underset,' +\.'brd:sideset,' +\.'sbr:Fractions,' +\.'brd:frac,' +\.'brd:dfrac,' +\.'brd:tfrac,' +\.'brd:cfrac,' +\.'brd:binom,' +\.'brd:dbinom,' +\.'brd:tbinom,' +\.'brs:genfrac{<+ldelim+>}{<+rdelim+>}{<+thick+>}{<+style+>}{<+numer+>}{<+denom+>},' +\.'sbr:Commands,' +\.'nob:smash,' +\.'bra:substack,' +\.'bra:tag,' +\.'bra:tag*,' +\.'nor:notag,' +\.'bra:raisetag,' +\.'bra:shoveleft,' +\.'bra:shoveright,' +\.'bra:intertext,' +\.'bra:text,' +\.'nor:displaybreak,' +\.'noo:displaybreak,' +\.'noo:allowdisplaybreaks,' +\.'nor:nobreakdash,' +\.'brs:numberwithin{<+env+>}{<+parent+>},' +\.'bra:leftroot,' +\.'bra:uproot,' +\.'bra:boxed,' +\.'brs:DeclareMathSymbol{<++>}{<++>}{<++>}{<++>},' +\.'bra:eqref' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/amsthm b/vim-latex/ftplugin/latex-suite/packages/amsthm new file mode 100644 index 0000000..6bae018 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/amsthm @@ -0,0 +1,21 @@ +if exists("amsthm_package_file") + finish +endif +let amsthm_package_file = 1 + +let TeX_package_option_amsthm = '' + +let TeX_package_amsthm = +\ 'env:proof,' +\.'nor:swapnumbers,' +\.'brd:newtheorem,' +\.'brd:newtheorem*,' +\.'nor:theoremstyle{plain},' +\.'nor:theoremstyle{definition},' +\.'nor:theoremstyle{remark},' +\.'nor:newtheoremstyle,' +\.'nor:qedsymbol,' +\.'nor:qed,' +\.'nor:qedhere' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/amsxtra b/vim-latex/ftplugin/latex-suite/packages/amsxtra new file mode 100644 index 0000000..3875cc3 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/amsxtra @@ -0,0 +1,12 @@ +if exists("amsxtra_package_file") + finish +endif +let amsxtra_package_file = 1 + +let g:TeX_package_option_amsxtra = '' + +let g:TeX_package_amsxtra = +\ 'nor:sphat,' +\.'nor:sptilde' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/arabic b/vim-latex/ftplugin/latex-suite/packages/arabic new file mode 100644 index 0000000..46f8314 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/arabic @@ -0,0 +1,10 @@ +if exists("arabic_package_file") + finish +endif +let arabic_package_file = 1 + +let g:TeX_package_option_arabic = '' + +let g:TeX_package_arabic = 'bra:arabicnumeral' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/array b/vim-latex/ftplugin/latex-suite/packages/array new file mode 100644 index 0000000..99f3dbc --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/array @@ -0,0 +1,17 @@ +if exists("array_package_file") + finish +endif +let array_package_file = 1 + +let g:TeX_package_option_array = '' + +let g:TeX_package_array = +\ 'brs:newcolumntype{<+type+>}[<+no+>]{<+preamble+>},' +\.'arraycolsep,' +\.'tabcolsep,' +\.'arrayrulewidth,' +\.'doublerulesep,' +\.'arraystretch,' +\.'extrarowheight' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/babel b/vim-latex/ftplugin/latex-suite/packages/babel new file mode 100644 index 0000000..cdb76ec --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/babel @@ -0,0 +1,98 @@ +if exists("babel_package_file") + finish +endif +let babel_package_file = 1 + +" This package sets some language specific options. +" Since it needs to find out which options the user used with the babel +" package, it needs to wait till latex-suite is done scanning packages. It +" then catches the LatexSuiteScannedPackages event which +" Tex_pack_updateall() throws at which time g:Tex_pack_detected and +" g:Tex_babel_options contain the necessary information. + +let g:TeX_package_option_babel = +\ 'afrikaans,' +\.'bahasa,' +\.'basque,' +\.'breton,' +\.'bulgarian,' +\.'catalan,' +\.'croatian,' +\.'chech,' +\.'danish,' +\.'dutch,' +\.'english,USenglish,american,UKenglish,british,canadian,' +\.'esperanto,' +\.'estonian,' +\.'finnish,' +\.'french,francais,canadien,acadian,' +\.'galician,' +\.'austrian,german,germanb,ngerman,naustrian,' +\.'greek,polutonikogreek,' +\.'hebrew,' +\.'magyar,hungarian,' +\.'icelandic,' +\.'irish,' +\.'italian,' +\.'latin,' +\.'lowersorbian,' +\.'samin,' +\.'norsk,nynorsk,' +\.'polish,' +\.'portuges,portuguese,brazilian,brazil,' +\.'romanian,' +\.'russian,' +\.'scottish,' +\.'spanish,' +\.'slovak,' +\.'slovene,' +\.'swedish,' +\.'serbian,' +\.'turkish,' +\.'ukrainian,' +\.'uppersorbian,' +\.'welsh' + +let g:TeX_package_babel = +\ 'bra:selectlanguage,' +\.'env:otherlanguage,' +\.'env:otherlanguage*,' +\.'env:hyphenrules,' +\.'brd:foreignlanguage,' +\.'spe:iflanguage{<+name+>}{<+true+>}{<+false+>},' +\.'languagename,' +\.'bra:useshorthands,' +\.'brd:defineshorthand,' +\.'brd:aliasshorthand,' +\.'bra:languageshorthans,' +\.'bra:shorthandon,' +\.'bra:shorthandoff,' +\.'brd:languageattribute' + +" vim:ft=vim:ff=unix: +if exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +augroup LatexSuite + au LatexSuite User LatexSuiteScannedPackages + \ call Tex_Debug('babel: catching LatexSuiteScannedPackages event') | + \ call s:SetQuotes() +augroup END + +let s:path = expand('<sfile>:p:h') + +" SetQuotes: sets quotes for various languages {{{ +" Description: +function! <SID>SetQuotes() + if g:Tex_package_detected =~ '\<babel\>' + if g:Tex_babel_options =~ '\<german\>' + exec 'so '.s:path.'/german' + elseif g:Tex_babel_options =~ '\<ngerman\>' + exec 'so '.s:path.'/ngerman' + endif + endif +endfunction " }}} + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/bar b/vim-latex/ftplugin/latex-suite/packages/bar new file mode 100644 index 0000000..0087b95 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/bar @@ -0,0 +1,27 @@ +if exists("bar_package_file") + finish +endif +let bar_package_file = 1 + +let g:TeX_package_option_bar = '' + +let g:TeX_package_bar = +\ 'env:barenv,' +\.'brs:bar{<+height+>}{<+index+>}[<+desc+>],' +\.'hlineon,' +\.'brs:legend{<+index+>}{<+text+>},' +\.'bra:setdepth,' +\.'bra:sethspace,' +\.'brs:setlinestyle{<+solid-dotted+>},' +\.'brs:setnumberpos{<+empty-axis-down-inside-outside-up+>},' +\.'bra:setprecision,' +\.'bra:setstretch,' +\.'bra:setstyle,' +\.'bra:setwidth,' +\.'brs:setxaxis{<+w1+>}{<+w2+>}{<+step+>},' +\.'brs:setyaxis[<+n+>]{<+w1+>}{<+w2+>}{<+step+>},' +\.'brs:setxname[<+lrbt+>]{<+etiquette+>},' +\.'brs:setyname[<+lrbt+>]{<+etiquette+>},' +\.'brs:setxvaluetyp{<+day-month+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/biblatex b/vim-latex/ftplugin/latex-suite/packages/biblatex new file mode 100644 index 0000000..3729ebf --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/biblatex @@ -0,0 +1,159 @@ +" Biblatex package support v 0.1 2010-02-17 +" This file has been written by +" Andreas Wagner <Andreas dot Wagner at em dot uni-frankfurt dot de> +" based on the documentation of +" biblatex 0.8e, July 4 2009. +" It can be used, modified and distributed according to the vim license. + + +if exists("biblatex_package_file") + finish +endif +let biblatex_package_file = 1 + +let g:TeX_package_option_biblatex = +\ 'style=,' +\.'citestyle=,' +\.'bibstyle=,' +\.'natbib=,' +\.'sorting=,' +\.'sortlos=,' +\.'sortcites=,' +\.'maxnames=,' +\.'minnames=,' +\.'maxitems=,' +\.'minitems=,' +\.'autocite=,' +\.'autopunct=,' +\.'babel=,' +\.'block=,' +\.'hyperref=,' +\.'backref=,' +\.'indexing=,' +\.'loadfiles=,' +\.'refsection=,' +\.'refsegment=,' +\.'citereset=,' +\.'abbreviate=,' +\.'date=,' +\.'urldate=,' +\.'defernums=,' +\.'punctfont=,' +\.'arxiv=,' +\.'backend=,' +\.'mincrossrefs=,' +\.'bibencoding=,' +\.'useauthor=,' +\.'useeditor=,' +\.'usetranslator=,' +\.'useprefix=,' +\.'skipbib=,' +\.'skiplos=,' +\.'skiplab=,' +\.'dataonly=,' +\.'pagetracker=,' +\.'citetracker=,' +\.'ibidtracker=,' +\.'idemtracker=,' +\.'opcittracker=,' +\.'loccittracker=,' +\.'firstinits=,' +\.'terseinits=,' +\.'labelalpha=,' +\.'labelnumber=,' +\.'labelyear=,' +\.'singletitle=,' +\.'uniquename=,' +\.'openbib' + +let g:TeX_package_biblatex = +\ 'sbr:preamble,' +\.'bra:ExecuteBibliographyOptions{<+key=value+>},' +\.'bra:Bibliography{<+file+>},' +\.'sbr:localization,' +\.'brd:DefineBibliographyStrings{<+lang+>}{<+definitions+>},' +\.'brd:DefineBibliographyExtras{<+lang+>}{<+code+>},' +\.'brd:UndefineBibliographyExtras{<+lang+>}{<+code+>},' +\.'brd:DefineHyphenationExceptions{<+lang+>}{<+text+>},' +\.'bra:NewBibliographyString{<+key+>},' +\.'sbr:main_commands,' +\.'brs:cite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Cite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:cite*[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:parencite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Parencite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:parencite*[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:footcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Footcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:textcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Textcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'bra:supercite{<+key+>},' +\.'brs:autocite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Autocite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:autocite*[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Autocite*[<+prenote+>][<+postnote+>]{<+key+>},' +\.'sbr:multicites,' +\.'brs:cites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Cites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:parencites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Parencites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:footcites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Footcites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:textcites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Textcites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:supercites(<+prenote+>)(<+postnote+>){<+key+>}{<+key+>},' +\.'brs:autocites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Autocites(<+prenote+>)(<+postnote+>)[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+prenote+>][<+postnote+>]{<+key+>},' +\.'sbr:text_commands,' +\.'brs:citeauthor[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Citeauthor[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:citetitle[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:citetitle*[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:citeyear[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:citeurl[<+prenote+>][<+postnote+>]{<+key+>},' +\.'sbr:special_commands,' +\.'bra:nocite{<+key+>},' +\.'nor:citereset,' +\.'nor:citereset*,' +\.'nor:mancite,' +\.'brs:fullcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:footfullcite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:volcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:Volcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:pvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:Pvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:fvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:Fvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:tvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:Tvolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:avolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:Avolcite[<+prenote+>]{<+volume+>}[<+page+>]{<+key+>},' +\.'brs:notecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Notecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:pnotecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Pnotecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:fnotecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:Fnotecite[<+prenote+>][<+postnote+>]{<+key+>},' +\.'brs:citename[<+prenote+>][<+postnote+>]{<+key+>}[<+format+>]{<+list+>},' +\.'brs:citelist[<+prenote+>][<+postnote+>]{<+key+>}[<+format+>]{<+list+>},' +\.'brs:citefield[<+prenote+>][<+postnote+>]{<+key+>}[<+format+>]{<+field+>},' +\.'sbr:sorting,' +\.'eno:refsection[<+bibfiles+>],' +\.'noo:newrefsection[<+bibfiles+>],' +\.'eno:refsegment[<+bibfiles+>],' +\.'noo:newsegment[<+bibfiles+>],' +\.'bra:DeclareBibliographyCategory{<+category+>},' +\.'brd:addtocategory{<+category+>}{<+key+>},' +\.'brd:defbibheading{<+name+>}{<+code+>},' +\.'brd:defbibnote{<+name+>}{<+text+>},' +\.'bra:segment,' +\.'bra:type,' +\.'bra:keyword,' +\.'bra:category,' +\.'sbr:endmatter,' +\.'noo:printbibliography[<+key=value+>],' +\.'noo:printshorthands[<+key=value+>],' +\.'noo:bibbysection[<+key=value+>],' +\.'noo:bibbysegment[<+key=value+>],' +\.'noo:bibbycategory[<+key=value+>]' + diff --git a/vim-latex/ftplugin/latex-suite/packages/bm b/vim-latex/ftplugin/latex-suite/packages/bm new file mode 100644 index 0000000..1cd5109 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/bm @@ -0,0 +1,10 @@ +if exists("bm_package_file") + finish +endif +let bm_package_file = 1 + +let g:TeX_package_option_bm = '' + +let g:TeX_package_bm = 'bra:bm' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/bophook b/vim-latex/ftplugin/latex-suite/packages/bophook new file mode 100644 index 0000000..16ca8b0 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/bophook @@ -0,0 +1,12 @@ +if exists("bophook_package_file") + finish +endif +let bophook_package_file = 1 + +let g:TeX_package_option_bophook = '' + +let g:TeX_package_bophook = +\ 'bra:AtBeginPage,' +\.'bra:PageLayout' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/boxedminipage b/vim-latex/ftplugin/latex-suite/packages/boxedminipage new file mode 100644 index 0000000..0917352 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/boxedminipage @@ -0,0 +1,10 @@ +if exists("boxedminipage_package_file") + finish +endif +let boxedminipage_package_file = 1 + +let g:TeX_package_option_boxedminipage = '' + +let g:TeX_package_boxedminipage = 'ens:boxedminipage:[<+pos+>]{<+size+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/caption2 b/vim-latex/ftplugin/latex-suite/packages/caption2 new file mode 100644 index 0000000..7e16031 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/caption2 @@ -0,0 +1,43 @@ +if exists("caption2_package_file") + finish +endif +let caption2_package_file = 1 + +let g:TeX_package_option_caption2 = +\ 'scriptsize,' +\.'footnotesize,' +\.'small,' +\.'normalsize,' +\.'large,' +\.'Large,' +\.'up,' +\.'it,' +\.'sl,' +\.'sc,' +\.'md,' +\.'bf,' +\.'rm,' +\.'sf,' +\.'tt,' +\.'ruled,' +\.'boxed,' +\.'centerlast,' +\.'anne,' +\.'center,' +\.'flushleft,' +\.'flushright,' +\.'oneline,' +\.'nooneline,' +\.'hang,' +\.'isu,' +\.'indent,' +\.'longtable' + +let g:TeX_package_caption2 = +\ 'bra:captionsize,' +\.'bra:captionfont,' +\.'bra:captionlabelfont,' +\.'bra:setcaptionmargin,' +\.'bra:setcaptionwidth' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/cases b/vim-latex/ftplugin/latex-suite/packages/cases new file mode 100644 index 0000000..a2deafe --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/cases @@ -0,0 +1,12 @@ +if exists("cases_package_file") + finish +endif +let cases_package_file = 1 + +let g:TeX_package_option_cases = '' + +let g:TeX_package_cases = +\ 'ens:numcases:{<+label+>},' +\.'ens:subnumcases:{<+label+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/ccaption b/vim-latex/ftplugin/latex-suite/packages/ccaption new file mode 100644 index 0000000..2ec3f2f --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/ccaption @@ -0,0 +1,20 @@ +if exists("ccaption_package_file") + finish +endif +let ccaption_package_file = 1 + +let g:TeX_package_option_ccaption = '' + +let g:TeX_package_ccaption = +\ 'bra:contcaption,' +\.'bra:legend,' +\.'bra:namedlegend,' +\.'abovelegendskip,' +\.'belowlegendskip,' +\.'brd:newfixedcaption,' +\.'brd:renewfixedcaption,' +\.'brd:providefixedcaption,' +\.'brs:newfloatenv[<+counter+>]{<+name+>}{<+ext+>}{<+etiq+>},' +\.'brd:listfloats' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/changebar b/vim-latex/ftplugin/latex-suite/packages/changebar new file mode 100644 index 0000000..e5002cf --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/changebar @@ -0,0 +1,35 @@ +if exists("changebar_package_file") + finish +endif +let changebar_package_file = 1 + +let g:TeX_package_option_changebar = +\ 'DVItoLN03,' +\.'dvitoln03,' +\.'DVItoPS,' +\.'dvitops,' +\.'DVIps,' +\.'dvips,' +\.'emTeX,' +\.'emtex,' +\.'textures,' +\.'Textures,' +\.'outerbars,' +\.'innerbars,' +\.'leftbars,' +\.'rightbars,' +\.'traceon,' +\.'traceoff' + +let g:TeX_package_changebar = +\ 'ens:changebar:[<+thickness+>],' +\.'noo:cbstart,' +\.'cbend,' +\.'cbdelete,' +\.'changebarwidth,' +\.'deletebarwidth,' +\.'changebarsep,' +\.'spe:changebargrey,' +\.'nochangebars' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/chapterbib b/vim-latex/ftplugin/latex-suite/packages/chapterbib new file mode 100644 index 0000000..331e901 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/chapterbib @@ -0,0 +1,24 @@ +if exists("chapterbib_package_file") + finish +endif +let chapterbib_package_file = 1 + +let g:TeX_package_option_chapterbib = +\ 'sectionbib,' +\.'rootbib,' +\.'gather,' +\.'duplicate' + +let g:TeX_package_chapterbib = +\ 'env:cbunit,' +\.'brd:sectionbib,' +\.'bra:cbinput,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/cite b/vim-latex/ftplugin/latex-suite/packages/cite new file mode 100644 index 0000000..aa43e5b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/cite @@ -0,0 +1,32 @@ +if exists("cite_package_file") + finish +endif +let cite_package_file = 1 + +let g:TeX_package_option_cite = +\ 'verbose,' +\.'nospace,' +\.'space,' +\.'nosort,' +\.'sort,' +\.'noadjust' + +let g:TeX_package_cite = +\ 'bra:cite,' +\.'bra:citen,' +\.'bra:citenum,' +\.'bra:citeonline,' +\.'bra:nocite,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citenum\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citeonline\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/color b/vim-latex/ftplugin/latex-suite/packages/color new file mode 100644 index 0000000..7f3aeac --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/color @@ -0,0 +1,43 @@ +if exists("color_package_file") + finish +endif +let color_package_file = 1 + +let g:TeX_package_option_color = +\ 'monochrome,' +\.'debugshow,' +\.'dvips,' +\.'xdvi,' +\.'dvipdf,' +\.'pdftex,' +\.'dvipsone,' +\.'dviwindo,' +\.'emtex,' +\.'dviwin,' +\.'oztex,' +\.'textures,' +\.'pctexps,' +\.'pctexwin,' +\.'pctexhp,' +\.'pctex32,' +\.'truetex,' +\.'tcidvi,' +\.'dvipsnames,' +\.'nodvipsnames,' +\.'usenames' + +let g:TeX_package_color = +\ 'brs:definecolor{<++>}{<++>}{<++>},' +\.'brs:DefineNamedColor{<++>}{<++>}{<++>}{<++>},' +\.'bra:color,' +\.'nob:color,' +\.'brd:textcolor,' +\.'brs:textcolor[<++>]{<++>}{<++>},' +\.'brd:colorbox,' +\.'brs:colorbox[<++>]{<++>}{<++>},' +\.'brs:fcolorbox{<++>}{<++>}{<++>},' +\.'brs:fcolorbox[<++>]{<++>}{<++>}{<++>},' +\.'brd:pagecolor,' +\.'nob:pagecolor' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/comma b/vim-latex/ftplugin/latex-suite/packages/comma new file mode 100644 index 0000000..5ec8d70 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/comma @@ -0,0 +1,12 @@ +if exists("comma_package_file") + finish +endif +let comma_package_file = 1 + +let g:TeX_package_option_comma = '' + +let g:TeX_package_comma = +\ 'bra:commaform,' +\.'bra:commaformtoken' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/csquotes b/vim-latex/ftplugin/latex-suite/packages/csquotes new file mode 100644 index 0000000..ac12932 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/csquotes @@ -0,0 +1,104 @@ +" Csquotes package support v 0.1 2010-02-17 +" This file has been written by +" Andreas Wagner <Andreas dot Wagner at em dot uni-frankfurt dot de> +" based on the documentation of +" csquotes 4.4a, July 4 2009 +" It can be used, modified and distributed according to the vim license. + + +if exists("csquotes_package_file") + finish +endif +let csquotes_package_file = 1 + +let g:TeX_package_option_csquotes = +\ 'strict=,' +\.'babel=,' +\.'maxlevel=,' +\.'style=,' +\.'danish=,' +\.'english=,' +\.'french=,' +\.'german=,' +\.'italian=,' +\.'norwegian=,' +\.'portuguese=,' +\.'spanish=,' +\.'swedish=' + +let g:TeX_package_csquotes = +\ 'sbr:basic,' +\.'bra:enquote{<+text+>},' +\.'bra:enquote*{<+text+>},' +\.'brs:textquote[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:textquote*[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:blockquote[<+cite+>][<+punct+>]{<+text+>},' +\.'sbr:foreign_text,' +\.'brd:foreignquote{<+lang+>}{<+text+>},' +\.'brd:foreignquote*{<+lang+>}{<+text+>},' +\.'brd:hyphenquote{<+lang+>}{<+text+>},' +\.'brd:hyphenquote*{<+lang+>}{<+text+>},' +\.'brs:foreigntextquote{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:foreigntextquote*{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:hyphentextquote{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:hyphentextquote*{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:foreignblockquote{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'brs:hyphenblockquote{<+lang+>}[<+cite+>][<+punct+>]{<+text+>},' +\.'sbr:active_quotes,' +\.'bra:MakeOuterQuote{<+character+>},' +\.'bra:MakeInnerQuote{<+character+>},' +\.'brd:MakeAutoQuote{<+opening_character+>}{<+closing_character+>},' +\.'brd:MakeAutoQuote*{<+opening_character+>}{<+closing_character+>},' +\.'brs:MakeForeignQuote{<+lang+>}{<+opening_character+>}{<+closing_character+>},' +\.'brs:MakeForeignQuote*{<+lang+>}{<+opening_character+>}{<+closing_character+>},' +\.'brs:MakeHyphenQuote{<+lang+>}{<+opening_character+>}{<+closing_character+>},' +\.'brs:MakeHyphenQuote*{<+lang+>}{<+opening_character+>}{<+closing_character+>},' +\.'brs:MakeBlockQuote{<+opening_character+>}{<+delimiter+>}{<+closing_character+>},' +\.'brs:MakeForeignBlockQuote{<+lang+>}{<+opening_character+>}{<+delimiter+>}{<+closing_character+>},' +\.'brs:MakeHyphenBlockQuote{<+lang+>}{<+opening_character+>}{<+delimiter+>}{<+closing_character+>},' +\.'nor:EnableQuote,' +\.'nor:DisableQuotes,' +\.'nor:VerbatimQuotes,' +\.'nor:DeleteQuotes,' +\.'sbr:automatic_citation,' +\.'brs:textcquote[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:textcquote*[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:foreigntextcquote{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:foreigntextcquote*{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:hyphentextcquote{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:hyphentextcquote*{<+x+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:blockcquote[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:foreignblockcquote{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'brs:hyphenblockcquote{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>]{<+text+>},' +\.'sbr:display_quotes,' +\.'ens:displayquote:[<+cite+>][<+punct+>],' +\.'ens:foreigndisplayquote:{<+lang+>}[<+cite+>][<+punct+>],' +\.'ens:hyphendisplayquote:{<+lang+>}[<+cite+>][<+punct+>],' +\.'ens:displaycquote:[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>],' +\.'ens:foreigndisplaycquote:{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>],' +\.'ens:hyphendisplaycquote:{<+lang+>}[<+prenote+>][<+postnote+>]{<+key+>}[<+punct+>],' +\.'sbr:config,' +\.'nob:setquotestyle,' +\.'nor:setquotestyle*,' +\.'brs:DeclareQuoteStyle[<+variant+>]{<+style+>}[<+outer_init+>][<+inner_init+>]{<+opening_outer_mark+>}[<+middle_outer_mark+>]{<+closing_outer_mark+>}[<+kern+>]{<+opening_inner_mark+>}[<+middle_inner_mark+>]{<+closing_inner_mark+>},' +\.'brs:DeclareQuoteAlias[<+variant+>]{<+style+>}{<+alias+>},' +\.'bra:DeclareQuoteOption{<+style+>},' +\.'bra:ExecuteQuoteOptions{<+key=value+>},' +\.'brs:DeclarePlainStyle{<+opening_outer_mark+>}{<+closing_outer_mark+>}{<+opening_inner_mark+>}{<+closing_inner_mark+>},' +\.'bra:SetBlockThreshold{<+integer+>},' +\.'bra:SetBlockEnvironment{<+environment+>},' +\.'bra:SetCiteCommand{<+command+>},' +\.'sbr:helper_expressions,' +\.'brd:ifblockquote,' +\.'brd:ifquotepunct,' +\.'brd:ifquoteterm,' +\.'brd:ifquotecolon,' +\.'brd:ifquotecomma,' +\.'brd:ifquoteexcmlam,' +\.'brd:ifquotequestion,' +\.'brd:ifquotesemicolon,' +\.'brs:ifstringblank{<+string+>}{<+true+>}{<+false+>}' + +let g:TeX_SmartQuoteOpen = "\\enquote\{" +let g:TeX_SmartQuoteClose = "\}" + diff --git a/vim-latex/ftplugin/latex-suite/packages/deleq b/vim-latex/ftplugin/latex-suite/packages/deleq new file mode 100644 index 0000000..58426d2 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/deleq @@ -0,0 +1,36 @@ +if exists("deleq_package_file") + finish +endif +let deleq_package_file = 1 + +let g:TeX_package_option_deleq = '' + +let g:TeX_package_deleq = +\.'env:deqn,' +\.'env:ddeqn,' +\.'env:deqarr,' +\.'env:ddeqar,' +\.'env:deqrarr,' +\.'nor:nydeqno,' +\.'nor:heqno,' +\.'bra:reqno,' +\.'bra:rndeqno,' +\.'bra:rdeqno,' +\.'nob:eqreqno,' +\.'nob:deqreqno,' +\.'nob:ddeqreqno,' +\.'bra:arrlabel,' +\.'nor:where,' +\.'bra:remtext,' +\.'nor:nydeleqno,' +\.'nor:deleqno,' +\.'nor:jotbaseline' + +if !exists("tex_no_math") + syn region texMathZoneA start="\\begin\s*{\s*deqn\*\s*}" end="\\end\s*{\s*deqn\*\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneB start="\\begin\s*{\s*ddeqn\*\s*}" end="\\end\s*{\s*ddeqn\*\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneC start="\\begin\s*{\s*deqarr\s*}" end="\\end\s*{\s*deqarr\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneD start="\\begin\s*{\s*ddeqar\s*}" end="\\end\s*{\s*ddeqar\s*}" keepend fold contains=@texMathZoneGroup + syn region texMathZoneE start="\\begin\s*{\s*deqrarr\*\s*}" end="\\end\s*{\s*deqrarr\*\s*}" keepend fold contains=@texMathZoneGroup +endif +" vim:ft=vim:ff=unix:noet:ts=4: diff --git a/vim-latex/ftplugin/latex-suite/packages/drftcite b/vim-latex/ftplugin/latex-suite/packages/drftcite new file mode 100644 index 0000000..8c30447 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/drftcite @@ -0,0 +1,29 @@ +if exists("drftcite_package_file") + finish +endif +let drftcite_package_file = 1 + +let g:TeX_package_option_drftcite = +\ 'verbose,' +\.'nospace,' +\.'space,' +\.'breakcites,' +\.'manualsort,' +\.'tt,' +\.'shownumbers,' +\.'nocitecount' + +let g:TeX_package_drftcite = +\ 'bra:cite,' +\.'bra:citen,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/dropping b/vim-latex/ftplugin/latex-suite/packages/dropping new file mode 100644 index 0000000..bcfc11f --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/dropping @@ -0,0 +1,12 @@ +if exists("dropping_package_file") + finish +endif +let dropping_package_file = 1 + +let g:TeX_package_option_dropping = '' + +let g:TeX_package_dropping = +\ 'brs:bigdrop{<+indent+>}{<+big+>}{<+font+>}{<+text+>},' +\.'brs:dropping[<+indent+>]{<+big+>}{<+text+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/enumerate b/vim-latex/ftplugin/latex-suite/packages/enumerate new file mode 100644 index 0000000..40c3f7c --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/enumerate @@ -0,0 +1,10 @@ +if exists("enumerate_package_file") + finish +endif +let enumerate_package_file = 1 + +let g:TeX_package_option_enumerate = '' + +let g:TeX_package_enumerate = 'ens:enumerate:[<+prefix+>]' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/eqlist b/vim-latex/ftplugin/latex-suite/packages/eqlist new file mode 100644 index 0000000..e1e249e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/eqlist @@ -0,0 +1,19 @@ +if exists("eqlist_package_file") + finish +endif +let eqlist_package_file = 1 + +let g:TeX_package_option_eqlist = '' + +let g:TeX_package_eqlist = +\ 'env:eqlist,' +\.'env:eqlist*,' +\.'env:Eqlist,' +\.'env:Eqlist*,' +\.'sep:modificators,' +\.'eqlistinit,' +\.'eqliststarinit,' +\.'eqlistinitpar,' +\.'eqlistlabel' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/eqparbox b/vim-latex/ftplugin/latex-suite/packages/eqparbox new file mode 100644 index 0000000..a05061b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/eqparbox @@ -0,0 +1,12 @@ +if exists("eqparbox_package_file") + finish +endif +let eqparbox_package_file = 1 + +let g:TeX_package_option_eqparbox = '' + +let g:TeX_package_eqparbox = +\ 'brs:eqparbox[<+pos+>][<+height+>][<+inner-pos+>]{<+tag+>}{<+text+>},' +\.'bra:eqboxwidth' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/everyshi b/vim-latex/ftplugin/latex-suite/packages/everyshi new file mode 100644 index 0000000..e42a3d5 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/everyshi @@ -0,0 +1,10 @@ +if exists("everyshi_package_file") + finish +endif +let everyshi_package_file = 1 + +let g:TeX_package_option_everyshi = '' + +let g:TeX_package_everyshi = 'bra:EveryShipOut' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/exmpl b/vim-latex/ftplugin/latex-suite/packages/exmpl new file mode 100644 index 0000000..e9e37fc --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/exmpl @@ -0,0 +1,55 @@ +if exists("exmpl_package_file") + finish +endif +let exmpl_package_file = 1 + +" Author: Mikolaj Machowski +" Date: 10.04.2002 +" Example plugin for packages in latexSuite +" + +" This variable creates Options submenu in package menu. Even when no options are +" given for this package it HAS to exist in form +" let TeX_package_option_exmpl = "" +" Options and commands are delimited with comma , + +let g:TeX_package_option_exmpl = "OpcjaA=,OpcjaB,OpcjaC" + +" Most command should have some definition before. Package menu system can +" recognize type of command and behave in good manner: +" env: (environment) creates simple environment template +" \begin{command} +" x <- cursor here +" \end{command} +" +" bra: (brackets) useful when inserting brackets commands +" \command{x}<<>> <- cursor at x, and placeholders as in other menu entries +" +" nor: (normal) nor: and pla: are `highlighted' in menu with `'' +" \command<Space> +" +" pla: (plain) +" command<Space> +" +" spe: (special) +" command <-literal insertion of command, in future here should go +" commands with special characters +" +" sep: (separator) creates separator. Good for aesthetics and usability :) +" +" Command can be also given with no prefix:. The result is +" \command (as in nor: but without <Space>) + + +let g:TeX_package_exmpl = "env:AEnvFirst,env:aEnvSec,env:BThi," + \ . "sep:a,env:zzzz," + \ . "bra:aBraFirst,bra:bBraSec,bra:cBraThi," + \ . "sep:b," + \ . "nor:aNorPri,nor:bNorSec,nor:cNorTer," + \ . "sep:c," + \ . "pla:aPla1,pla:bPla2,pla:cPla3," + \ . "sep:d," + \ . "spe:aSpe1,spe:bSpe2,spe:cSpe3," + \ . "sep:e," + \ . "aNo1,bNo2,cNo3" +" vim:ft=vim diff --git a/vim-latex/ftplugin/latex-suite/packages/fixme b/vim-latex/ftplugin/latex-suite/packages/fixme new file mode 100644 index 0000000..f6079bd --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/fixme @@ -0,0 +1,42 @@ +" Fixme package support v 0.1 2010-02-17 +" This file has been written by +" Andreas Wagner <Andreas dot Wagner at em dot uni-frankfurt dot de> +" based on the documentation of +" fixme November 28 2007 +" It can be used, modified and distributed according to the vim license. + + +if exists("fixme_package_file") + finish +endif +let fixme_package_file = 1 + +let g:TeX_package_option_fixme = +\ 'draft,' +\.'final,' +\.'silent,' +\.'nosilent,' +\.'inline,' +\.'margin,' +\.'marginclue,' +\.'footnote,' +\.'index,' +\.'noinline,' +\.'nomargin,' +\.'nomarginclue,' +\.'nofootnote,' +\.'noindex' + +let g:TeX_package_fixme = +\ 'sbr:simple,' +\.'nob:fixme[<+layout+>]{<+note+>},' +\.'nob:fxnote[<+layout+>]{<+note+>},' +\.'nob:fxwarning[<+layout+>]{<+note+>},' +\.'nob:fxerror[<+layout+>]{<+note+>},' +\.'sbr:environments,' +\.'eno:afixme[<+summary+>],' +\.'eno:anfxnote[<+summary+>],' +\.'eno:anfxwarning[<+summary+>],' +\.'eno:anfxerror[<+summary+>],' +\.'sbr:other,' +\.'nor:listoffixmes' diff --git a/vim-latex/ftplugin/latex-suite/packages/flafter b/vim-latex/ftplugin/latex-suite/packages/flafter new file mode 100644 index 0000000..8859397 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/flafter @@ -0,0 +1,10 @@ +if exists("flafter_package_file") + finish +endif +let flafter_package_file = 1 + +let g:TeX_package_option_flafter = '' + +let g:TeX_package_flafter = 'noo:suppressfloats,noo:suppress' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/float b/vim-latex/ftplugin/latex-suite/packages/float new file mode 100644 index 0000000..7c1cf46 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/float @@ -0,0 +1,16 @@ +if exists("float_package_file") + finish +endif +let float_package_file = 1 + +let g:TeX_package_option_float = '' + +let g:TeX_package_float = +\ 'bra:floatstyle,' +\.'brs:newfloat{<++>}{<++>}{<++>}[<++>],' +\.'brd:floatname,' +\.'brd:listof,' +\.'bra:restylefloat,' +\.'brd:floatplacement' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/floatflt b/vim-latex/ftplugin/latex-suite/packages/floatflt new file mode 100644 index 0000000..4902d89 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/floatflt @@ -0,0 +1,12 @@ +if exists("floatflt_package_file") + finish +endif +let floatflt_package_file = 1 + +let g:TeX_package_option_floatflt = 'rflt,lflt,vflt' + +let g:TeX_package_floatflt = +\ 'ens:floatingfigure:[<+loc+>]{<+spec+>},' +\.'ens:floatingtable:[<+loc+>]{<+spec+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/fn2end b/vim-latex/ftplugin/latex-suite/packages/fn2end new file mode 100644 index 0000000..aac4184 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/fn2end @@ -0,0 +1,10 @@ +if exists("fn2end_package_file") + finish +endif +let fn2end_package_file = 1 + +let g:TeX_package_option_fn2end = '' + +let g:TeX_package_fn2end = 'makeendnotes,theendnotes' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/footmisc b/vim-latex/ftplugin/latex-suite/packages/footmisc new file mode 100644 index 0000000..04723f6 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/footmisc @@ -0,0 +1,21 @@ +if exists("footmisc_package_file") + finish +endif +let footmisc_package_file = 1 + +let g:TeX_package_option_footmisc = +\ 'bottom,' +\.'flushmargin,' +\.'marginal,' +\.'multiple,' +\.'norule,' +\.'para,' +\.'perpage,' +\.'splitrule,' +\.'stable,' +\.'symbol,' +\.'symbol+' + +let g:TeX_package_footmisc = '' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/geometry b/vim-latex/ftplugin/latex-suite/packages/geometry new file mode 100644 index 0000000..667a289 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/geometry @@ -0,0 +1,93 @@ +if exists("geometry_package_file") + finish +endif +let geometry_package_file = 1 + +let g:TeX_package_option_geometry = +\ 'sbr:Boolean,' +\.'verbose,' +\.'landscape,' +\.'portrait,' +\.'twoside,' +\.'includemp,' +\.'reversemp,' +\.'reversemarginpar,' +\.'nohead,' +\.'nofoot,' +\.'noheadfoot,' +\.'dvips,' +\.'pdftex,' +\.'vtex,' +\.'truedimen,' +\.'reset,' +\.'sbr:BooleanDimensions,' +\.'a0paper,' +\.'a1paper,' +\.'a2paper,' +\.'a3paper,' +\.'a4paper,' +\.'a5paper,' +\.'a6paper,' +\.'b0paper,' +\.'b1paper,' +\.'b2paper,' +\.'b3paper,' +\.'b4paper,' +\.'b5paper,' +\.'b6paper,' +\.'letterpaper,' +\.'executivepaper,' +\.'legalpaper,' +\.'sbr:SingleValueOption,' +\.'paper=,' +\.'papername=,' +\.'paperwidth=,' +\.'paperheight=,' +\.'width=,' +\.'totalwidth=,' +\.'height=,' +\.'totalheight=,' +\.'left=,' +\.'lmargin=,' +\.'right=,' +\.'rmargin=,' +\.'top=,' +\.'tmargin=,' +\.'bottom=,' +\.'bmargin=,' +\.'hscale=,' +\.'vscale=,' +\.'textwidth=,' +\.'textheight=,' +\.'marginparwidth=,' +\.'marginpar=,' +\.'marginparsep=,' +\.'headheight=,' +\.'head=,' +\.'headsep=,' +\.'footskip=,' +\.'hoffset=,' +\.'voffset=,' +\.'twosideshift=,' +\.'mag=,' +\.'columnsep=,' +\.'footnotesep=,' +\.'sbr:TwoValueOptions,' +\.'papersize={<++>},' +\.'total={<++>},' +\.'body={<++>},' +\.'text={<++>},' +\.'scale={<++>},' +\.'hmargin={<++>},' +\.'vmargin={<++>},' +\.'margin={<++>},' +\.'offset={<++>},' +\.'sbr:ThreeValueOptions,' +\.'hdivide={<++>},' +\.'vdivide={<++>},' +\.'divide={<++>}' + +let g:TeX_package_geometry = +\ 'bra:geometry' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/german b/vim-latex/ftplugin/latex-suite/packages/german new file mode 100644 index 0000000..9aa7519 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/german @@ -0,0 +1,12 @@ +if exists("german_package_file") + finish +endif +let german_package_file = 1 + +let g:TeX_package_german = '' +let g:TeX_package_option_german = '' +" For now just define the smart quotes. +let b:Tex_SmartQuoteOpen = '"`' +let b:Tex_SmartQuoteClose = "\"'" + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/graphicx b/vim-latex/ftplugin/latex-suite/packages/graphicx new file mode 100644 index 0000000..4aa7571 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/graphicx @@ -0,0 +1,69 @@ +if exists("graphicx_package_file") + finish +endif +let graphicx_package_file = 1 + +let g:TeX_package_option_graphicx = +\ 'sbr:Drivers,' +\.'xdvi,' +\.'dvipdf,' +\.'dvipdfm,' +\.'pdftex,' +\.'dvipsone,' +\.'dviwindo,' +\.'emtex,' +\.'dviwin,' +\.'oztex,' +\.'textures,' +\.'pctexps,' +\.'pctexwin,' +\.'pctexhp,' +\.'pctex32,' +\.'truetex,' +\.'tcidvi,' +\.'vtex,' +\.'sbr:Rest,' +\.'debugshow,' +\.'draft,' +\.'final,' +\.'hiderotate,' +\.'hiresbb,' +\.'hidescale,' +\.'unknownkeysallowed,' +\.'unknownkeyserror' + +let g:TeX_package_graphicx = +\ 'sbr:Includegraphics,' +\.'brs:includegraphics[<++>]{<++>},' +\.'spe:height=,' +\.'spe:width=,' +\.'spe:keepaspectratio=,' +\.'spe:totalheight=,' +\.'spe:angle=,' +\.'spe:scale=,' +\.'spe:origin=,' +\.'spe:clip,' +\.'spe:bb=,' +\.'spe:viewport=,' +\.'spe:trim=,' +\.'spe:draft,' +\.'spe:hiresbb,' +\.'spe:type=,' +\.'spe:ext=,' +\.'spe:read=,' +\.'spe:command=,' +\.'sbr:Rotatebox,' +\.'brs:rotatebox[<++>]{<++>}{<++>},' +\.'spe:origin=,' +\.'spe:x=,' +\.'spe:y=,' +\.'spe:units=,' +\.'sbr:Rest,' +\.'brs:scalebox{<++>}[<++>]{<++>},' +\.'brs:resizebox{<++>}{<++>}{<++>},' +\.'brs:resizebox*{<++>}{<++>}{<++>},' +\.'bra:DeclareGraphicsExtensions,' +\.'brs:DeclareGraphicsRule{<++>}{<++>}{<++>}{<++>},' +\.'bra:graphicspath' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/graphpap b/vim-latex/ftplugin/latex-suite/packages/graphpap new file mode 100644 index 0000000..ebbd268 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/graphpap @@ -0,0 +1,10 @@ +if exists("graphpap_package_file") + finish +endif +let graphpap_package_file = 1 + +let g:TeX_package_option_graphpap = '' + +let g:TeX_package_graphpap = 'brs:graphpaper[<+step+>](<+x1,y1+>)(<+x2,y2+>)' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/harpoon b/vim-latex/ftplugin/latex-suite/packages/harpoon new file mode 100644 index 0000000..994801d --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/harpoon @@ -0,0 +1,18 @@ +if exists("harpoon_package_file") + finish +endif +let harpoon_package_file = 1 + +let g:TeX_package_option_harpoon = '' + +let g:TeX_package_harpoon = +\ 'bra:overleftharp,' +\.'bra:overrightharp,' +\.'bra:overleftharpdown,' +\.'bra:overrightharpdown,' +\.'bra:underleftharp,' +\.'bra:underrightharp,' +\.'bra:underleftharpdown,' +\.'bra:underrightharpdown' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/hhline b/vim-latex/ftplugin/latex-suite/packages/hhline new file mode 100644 index 0000000..a024c19 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/hhline @@ -0,0 +1,21 @@ +if exists("hhline_package_file") + finish +endif +let hhline_package_file = 1 + +let g:TeX_package_option_hhline = '' + +let g:TeX_package_hhline = +\ 'bra:hhline,' +\.'sep:a,' +\.'spe:=,' +\.'spe:-,' +\.'spe:~,' +\."spe:\\\|," +\.'spe::,' +\.'spe:#,' +\.'spe:t,' +\.'spe:b,' +\.'spe:*' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/histogram b/vim-latex/ftplugin/latex-suite/packages/histogram new file mode 100644 index 0000000..b18fc07 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/histogram @@ -0,0 +1,13 @@ +if exists("histogram_package_file") + finish +endif +let histogram_package_file = 1 + +let g:TeX_package_option_histogram = '' + +let g:TeX_package_histogram = +\ 'histogram,' +\.'noverticallines,' +\.'verticallines' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/hyperref b/vim-latex/ftplugin/latex-suite/packages/hyperref new file mode 100644 index 0000000..a82aac3 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/hyperref @@ -0,0 +1,167 @@ +if exists("hyperref_package_file") + finish +endif +let hyperref_package_file = 1 + +let g:TeX_package_option_hyperref = +\ '4=,' +\.'a4paper,' +\.'a5paper,' +\.'anchorcolor=,' +\.'b5paper,' +\.'backref=,' +\.'baseurl={<++>},' +\.'bookmarks=,' +\.'bookmarksnumbered=,' +\.'bookmarksopen=,' +\.'bookmarksopenlevel=,' +\.'bookmarkstype=,' +\.'breaklinks=,' +\.'citebordercolor=,' +\.'citecolor=,' +\.'colorlinks=,' +\.'debug=,' +\.'draft,' +\.'dvipdf,' +\.'dvipdfm,' +\.'dvips,' +\.'dvipsone,' +\.'dviwindo,' +\.'executivepaper,' +\.'extension=,' +\.'filebordercolor=,' +\.'filecolor=,' +\.'frenchlinks=,' +\.'hyperfigures=,' +\.'hyperindex=,' +\.'hypertex,' +\.'hypertexnames=,' +\.'implicit=,' +\.'latex2html,' +\.'legalpaper,' +\.'letterpaper,' +\.'linkbordercolor=,' +\.'linkcolor=,' +\.'linktocpage=,' +\.'menubordercolor=,' +\.'menucolor=,' +\.'naturalnames,' +\.'nesting=,' +\.'pageanchor=,' +\.'pagebackref=,' +\.'pagebordercolor=,' +\.'pagecolor=,' +\.'pdfauthor={<++>},' +\.'pdfborder=,' +\.'pdfcenterwindow=,' +\.'pdfcreator={<++>},' +\.'pdffitwindow,' +\.'pdfhighlight=,' +\.'pdfkeywords={<++>},' +\.'pdfmenubar=,' +\.'pdfnewwindow=,' +\.'pdfpagelabels=,' +\.'pdfpagelayout=,' +\.'pdfpagemode=,' +\.'pdfpagescrop=,' +\.'pdfpagetransition=,' +\.'pdfproducer={<++>},' +\.'pdfstartpage={<++>},' +\.'pdfstartview={<++>},' +\.'pdfsubject={<++>},' +\.'pdftex,' +\.'pdftitle={<++>},' +\.'pdftoolbar=,' +\.'pdfusetitle=,' +\.'pdfview,' +\.'pdfwindowui=,' +\.'plainpages=,' +\.'ps2pdf,' +\.'raiselinks=,' +\.'runbordercolor,' +\.'tex4ht,' +\.'textures,' +\.'unicode=,' +\.'urlbordercolor=,' +\.'urlcolor=,' +\.'verbose=,' +\.'vtex' + +let g:TeX_package_hyperref = +\ 'sbr:Preamble,' +\.'bra:hypersetup,' +\.'wwwbrowser,' +\.'sbr:Links,' +\.'bra:hyperbaseurl,' +\.'brs:href{<+URL+>}{<+text+>},' +\.'bra:hyperimage,' +\.'brs:hyperdef{<+category+>}{<+name+>}{<+text+>},' +\.'brs:hyperref{<+URL+>}{<+category+>}{<+name+>}{<+text+>},' +\.'brs:hyperlink{<+name+>}{<+text+>},' +\.'brs:hypertarget{<+name+>}{<+text+>},' +\.'bra:url,' +\.'bra:htmladdnormallink,' +\.'brs:Acrobatmenu{<+option+>}{<+tekst+>},' +\.'brs:pdfbookmark[<++>]{<++>}{<++>},' +\.'bra:thispdfpagelabel,' +\.'sbr:Forms,' +\.'env:Form,' +\.'sep:Forms1,' +\.'brs:TextField[<+parameters+>]{<+label+>},' +\.'brs:CheckBox[<+parameters+>]{<+label+>},' +\.'brs:ChoiceMenu[<+parameters+>]{<+label+>}{<+choices+>},' +\.'brs:PushButton[<+parameters+>]{<+label+>},' +\.'brs:Submit[<+parameters+>]{<+label+>},' +\.'brs:Reset[<+parameters+>]{<+label+>},' +\.'sep:Forms2,' +\.'brs:LayoutTextField{<+label+>}{<+field+>},' +\.'brs:LayoutChoiceField{<+label+>}{<+field+>},' +\.'brs:LayoutCheckboxField{<+label+>}{<+field+>},' +\.'sep:Forms3,' +\.'brs:MakeRadioField{<+width+>}{<+height+>},' +\.'brs:MakeCheckField{<+width+>}{<+height+>},' +\.'brs:MakeTextField{<+width+>}{<+height+>},' +\.'brs:MakeChoiceField{<+width+>}{<+height+>},' +\.'brs:MakeButtonField{<+text+>},' +\.'sbr:Parameters,' +\.'spe:accesskey,' +\.'spe:align,' +\.'spe:backgroundcolor,' +\.'spe:bordercolor,' +\.'spe:bordersep,' +\.'spe:borderwidth,' +\.'spe:charsize,' +\.'spe:checked,' +\.'spe:color,' +\.'spe:combo,' +\.'spe:default,' +\.'spe:disabled,' +\.'spe:height,' +\.'spe:hidden,' +\.'spe:maxlen,' +\.'spe:menulength,' +\.'spe:multiline,' +\.'spe:name,' +\.'spe:onblur,' +\.'spe:onchange,' +\.'spe:onclick,' +\.'spe:ondblclick,' +\.'spe:onfocus,' +\.'spe:onkeydown,' +\.'spe:onkeypress,' +\.'spe:onkeyup,' +\.'spe:onmousedown,' +\.'spe:onmousemove,' +\.'spe:onmouseout,' +\.'spe:onmouseover,' +\.'spe:onmouseup,' +\.'spe:onselect,' +\.'spe:password,' +\.'spe:popdown,' +\.'spe:radio,' +\.'spe:readonly,' +\.'spe:tabkey,' +\.'spe:value,' +\.'spe:width' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/ifthen b/vim-latex/ftplugin/latex-suite/packages/ifthen new file mode 100644 index 0000000..82dbe69 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/ifthen @@ -0,0 +1,21 @@ +if exists("ifthen_package_file") + finish +endif +let ifthen_package_file = 1 + +let g:TeX_package_option_ifthen = '' + +let g:TeX_package_ifthen = +\ 'brs:ifthenelse{<++>}{<++>}{<++>},' +\.'brd:equal,' +\.'bra:boolean,' +\.'bra:lengthtest,' +\.'bra:isodd,' +\.'brd:whiledo,' +\.'bra:newboolean,' +\.'brd:setboolean,' +\.'nor:and,' +\.'nor:or,' +\.'nor:not' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/inputenc b/vim-latex/ftplugin/latex-suite/packages/inputenc new file mode 100644 index 0000000..73abe9a --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/inputenc @@ -0,0 +1,29 @@ +if exists("inputenc_package_file") + finish +endif +let inputenc_package_file = 1 + +let g:TeX_package_option_inputenc = +\ 'ascii,' +\.'latin1,' +\.'latin2,' +\.'latin3,' +\.'latin4,' +\.'latin5,' +\.'latin9,' +\.'decmulti,' +\.'cp850,' +\.'cp852,' +\.'cp437,' +\.'cp437de,' +\.'cp865,' +\.'applemac,' +\.'next,' +\.'ansinew,' +\.'cp1250,' +\.'cp1252' + +let g:TeX_package_inputenc = +\ 'bra:inputencoding' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/letterspace b/vim-latex/ftplugin/latex-suite/packages/letterspace new file mode 100644 index 0000000..9a53eaa --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/letterspace @@ -0,0 +1,10 @@ +if exists("letterspace_package_file") + finish +endif +let letterspace_package_file = 1 + +let g:TeX_package_option_letterspace = '' + +let g:TeX_package_letterspace = 'nor:letterspace' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/lineno b/vim-latex/ftplugin/latex-suite/packages/lineno new file mode 100644 index 0000000..4567602 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/lineno @@ -0,0 +1,60 @@ +if exists("lineno_package_file") + finish +endif +let lineno_package_file = 1 + +let g:TeX_package_option_lineno = +\ 'left,' +\.'right,' +\.'switch,' +\.'switch*,' +\.'pagewise,' +\.'running,' +\.'modulo,' +\.'mathlines,' +\.'displaymath,' +\.'hyperref' + +let g:TeX_package_lineno = +\ 'sbr:Environments,' +\.'env:linenumbers,' +\.'env:linenumbers*,' +\.'env:numquote,' +\.'env:numquote*,' +\.'env:numquotation,' +\.'env:numquotation*,' +\.'env:bframe,' +\.'env:linenomath,' +\.'env:linenomath*,' +\.'bra:linelabel,' +\.'sbr:Commands,' +\.'nor:linenumbers,' +\.'nor:linenumbers*,' +\.'noo:linenumbers,' +\.'nor:nolinenumbers,' +\.'nor:runninglinenumbers,' +\.'nor:runninglinenumbers*,' +\.'noo:runninglinenumbers,' +\.'nor:pagewiselinenumbers,' +\.'nor:resetlinenumber,' +\.'noo:resetlinenumber,' +\.'nor:setrunninglinenumbers,' +\.'nor:setpagewiselinenumbers,' +\.'nor:switchlinenumbers,' +\.'nor:switchlinenumbers*,' +\.'nor:leftlinenumbers,' +\.'nor:leftlinenumbers*,' +\.'nor:rightlinenumbers,' +\.'nor:rightlinenumbers*,' +\.'nor:runningpagewiselinenumbers,' +\.'nor:realpagewiselinenumbers,' +\.'nor:modulolinenumbers,' +\.'noo:modulolinenumbers,' +\.'nor:linenumberdisplaymath,' +\.'nor:nolinenumberdisplaymath,' +\.'nor:thelinenumber,' +\.'nob:linerefp,' +\.'nob:linerefr,' +\.'nob:lineref' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/longtable b/vim-latex/ftplugin/latex-suite/packages/longtable new file mode 100644 index 0000000..6644862 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/longtable @@ -0,0 +1,35 @@ +if exists("longtable_package_file") + finish +endif +let longtable_package_file = 1 + +let g:TeX_package_option_longtable = +\ 'errorshow,' +\.'pausing,' +\.'set,' +\.'final' + +let g:TeX_package_longtable = +\ 'sbr:Commands,' +\.'nor:setlongtables,' +\.'bra:LTleft,' +\.'bra:LTright,' +\.'bra:LTpre,' +\.'bra:LTpost,' +\.'bra:LTchunksize,' +\.'bra:LTcapwidth,' +\.'bra:LTcapwidth,' +\.'sbr:Longtable,' +\.'env:longtable,' +\.'sep:lt,' +\.'nor:endhead,' +\.'nor:endfirsthead,' +\.'nor:endfoot,' +\.'nor:endlastfoot,' +\.'nor:kill,' +\.'bra:caption,' +\.'nob:caption,' +\.'bra:caption*,' +\.'nor:newpage' + +" vim:ft=vim:ts=4:sw=4:noet:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/lscape b/vim-latex/ftplugin/latex-suite/packages/lscape new file mode 100644 index 0000000..33976ea --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/lscape @@ -0,0 +1,10 @@ +if exists("lscape_package_file") + finish +endif +let lscape_package_file = 1 + +let g:TeX_package_option_lscape = '' + +let g:TeX_package_lscape = 'env:landscape' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/manyfoot b/vim-latex/ftplugin/latex-suite/packages/manyfoot new file mode 100644 index 0000000..7cab55f --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/manyfoot @@ -0,0 +1,15 @@ +if exists("manyfoot_package_file") + finish +endif +let manyfoot_package_file = 1 + +let g:TeX_package_option_manyfoot = 'para' + +let g:TeX_package_manyfoot = +\ 'bra:newfootnote,bra:newfootnote[para],' +\.'bra:footnoteA,bra:footnoteB,' +\.'bra:FootnoteA,bra:FootnoteB,' +\.'bra:Footnotemark,bra:Footnotetext,' +\.'SplitNote' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/moreverb b/vim-latex/ftplugin/latex-suite/packages/moreverb new file mode 100644 index 0000000..8614e3b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/moreverb @@ -0,0 +1,28 @@ +if exists("moreverb_package_file") + finish +endif +let moreverb_package_file = 1 + +let g:TeX_package_option_moreverb = '' + +let g:TeX_package_moreverb = +\ 'ens:verbatimwrite:{<++>},' +\.'ens:verbatimtab:[<++>],' +\.'ens:listing:[<+step+>]{<+number+>},' +\.'ens:listing*:[<+step+>]{<+number+>},' +\.'env:boxedverbatim,' +\.'bra:verbatimtabsize,' +\.'bra:listingoffset,' +\.'brs:listinginput[<++>]{<++>}{<++>},' +\.'brs:verbatimtabinput[<++>]{<++>}' + +let g:Tex_completion_explorer = g:Tex_completion_explorer.'verbatimtabinput,' + +syn region texZone start="\\begin{verbatimwrite}" end="\\end{verbatimwrite}\|%stopzone\>" fold +syn region texZone start="\\begin{verbatimtab}" end="\\end{verbatimtab}\|%stopzone\>" fold +syn region texZone start="\\begin{boxedverbatim}" end="\\end{boxedverbatim}\|%stopzone\>" fold +syn region texZone start="\\begin{listing}" end="\\end{listing}\|%stopzone\>" fold +syn region texZone start="\\begin{listing*}" end="\\end{listing*}\|%stopzone\>" fold + + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/multibox b/vim-latex/ftplugin/latex-suite/packages/multibox new file mode 100644 index 0000000..00bccb2 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/multibox @@ -0,0 +1,10 @@ +if exists("multibox_package_file") + finish +endif +let multibox_package_file = 1 + +let g:TeX_package_option_multibox = '' + +let g:TeX_package_multibox = 'multimake,multiframe' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/multicol b/vim-latex/ftplugin/latex-suite/packages/multicol new file mode 100644 index 0000000..ca93189 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/multicol @@ -0,0 +1,21 @@ +if exists("multicol_package_file") + finish +endif +let multicol_package_file = 1 + +let g:TeX_package_option_multicol = '' + +let g:TeX_package_multicol = +\ 'ens:multicols:{<+cols+>}[<+text+>][<+sep+>],' +\.'columnbreak,' +\.'premulticols,' +\.'postmulticols,' +\.'multicolsep,' +\.'columnsep,' +\.'linewidth,' +\.'columnseprule,' +\.'flushcolumnt,' +\.'raggedcolumns,' +\.'unbalanced' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/newalg b/vim-latex/ftplugin/latex-suite/packages/newalg new file mode 100644 index 0000000..1480bb6 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/newalg @@ -0,0 +1,26 @@ +if exists("newalg_package_file") + finish +endif +let newalg_package_file = 1 + +let g:TeX_package_option_newalg = '' + +let g:TeX_package_newalg = +\ 'ens:algorithm:{<+name+>}{<++>},' +\.'ens:IF:{<+cond+>},' +\.'ens:FOR:{<+loop+>},' +\.'ens:WHILE:{<+cond+>},' +\.'bra:ERROR,' +\.'nor:ELSE,' +\.'nor:RETURN,' +\.'nor:NIL,' +\.'nor:TO,' +\.'bra:CALL,' +\.'bra:text,' +\.'env:REPEAT,' +\.'env:SWITCH,' +\.'nor:=,' +\.'bra:item,' +\.'nor:algkey' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/ngerman b/vim-latex/ftplugin/latex-suite/packages/ngerman new file mode 100644 index 0000000..3f58025 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/ngerman @@ -0,0 +1,12 @@ +if exists("ngerman_package_file") + finish +endif +let ngerman_package_file = 1 + +let g:TeX_package_ngerman = '' +let g:TeX_package_option_ngerman = '' +" For now just define the smart quotes. +let b:Tex_SmartQuoteOpen = '"`' +let b:Tex_SmartQuoteClose = "\"'" + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/numprint b/vim-latex/ftplugin/latex-suite/packages/numprint new file mode 100644 index 0000000..4eab5a2 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/numprint @@ -0,0 +1,18 @@ +if exists("numprint_package_file") + finish +endif +let numprint_package_file = 1 + +let g:TeX_package_option_numprint = '' + +let g:TeX_package_numprint = +\ 'bra:numprint,' +\.'nob:numprint,' +\.'bra:thousandsep,' +\.'bra:decimalsign,' +\.'bra:productsign,' +\.'bra:unitseparator,' +\.'brd:expnumprint,' +\.'global' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/oldstyle b/vim-latex/ftplugin/latex-suite/packages/oldstyle new file mode 100644 index 0000000..72b2774 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/oldstyle @@ -0,0 +1,12 @@ +if exists("oldstyle_package_file") + finish +endif +let oldstyle_package_file = 1 + +let g:TeX_package_option_oldstyle = '' + +let g:TeX_package_oldstyle = +\ 'bra:textos,' +\.'bra:mathos' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/outliner b/vim-latex/ftplugin/latex-suite/packages/outliner new file mode 100644 index 0000000..ca64322 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/outliner @@ -0,0 +1,19 @@ +if exists("outliner_package_file") + finish +endif +let outliner_package_file = 1 + +let g:TeX_package_option_outliner = '' + +let g:TeX_package_outliner = +\ 'env:Outline,' +\.'bra:Level,' +\.'bra:SetBaseLevel,' +\.'sep:preamble,' +\.'bra:OutlinePageBreaks,' +\.'bra:OutlinePageBreaks,' +\.'bra:OutlineLevelStart,' +\.'bra:OutlineLevelCont,' +\.'bra:OutlineLevelEnd' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/overcite b/vim-latex/ftplugin/latex-suite/packages/overcite new file mode 100644 index 0000000..25bc17d --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/overcite @@ -0,0 +1,34 @@ +if exists("overcite_package_file") + finish +endif +let overcite_package_file = 1 + +let g:TeX_package_option_overcite = +\ 'verbose,' +\.'ref,' +\.'nospace,' +\.'space,' +\.'nosort,' +\.'sort,' +\.'nomove,' +\.'noadjust' + +let g:TeX_package_overcite = +\ 'bra:cite,' +\.'bra:citen,' +\.'bra:citenum,' +\.'bra:citeonline,' +\.'bra:nocite,' +\.'sep:redefine,' +\.'bra:citeform,' +\.'bra:citepunct,' +\.'bra:citeleft,' +\.'bra:citeright,' +\.'bra:citemid,' +\.'bra:citedash' + +syn region texRefZone matchgroup=texStatement start="\\citen\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citenum\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter +syn region texRefZone matchgroup=texStatement start="\\citeonline\([tp]\*\=\)\={" keepend end="}\|%stopzone\>" contains=texComment,texDelimiter + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/pagenote b/vim-latex/ftplugin/latex-suite/packages/pagenote new file mode 100644 index 0000000..4949db3 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/pagenote @@ -0,0 +1,26 @@ +" Pagenote package support v 0.1 2010-02-17 +" This file has been written by +" Andreas Wagner <Andreas dot Wagner at em dot uni-frankfurt dot de> +" based on the documentation of +" pagenote 27 September 2004 +" It can be used, modified and distributed according to the vim license. + + +if exists("pagenote_package_file") + finish +endif +let pagenote_package_file = 1 + +let g:TeX_package_option_pagenote = +\ 'continuous,' +\.'page' + +let g:TeX_package_pagenote = +\ 'sbr:preamble,' +\.'nor:makepagenote,' +\.'sbr:regular,' +\.'nob:pagenote[<+lemma+>]{<+note+>},' +\.'sbr:end,' +\.'nor:printnotes,' +\.'nor:printnotes*' + diff --git a/vim-latex/ftplugin/latex-suite/packages/parallel b/vim-latex/ftplugin/latex-suite/packages/parallel new file mode 100644 index 0000000..19dfe8e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/parallel @@ -0,0 +1,15 @@ +if exists("parallel_package_file") + finish +endif +let parallel_package_file = 1 + +let g:TeX_package_option_parallel = '' + +let g:TeX_package_parallel = +\ 'env:Parallel,' +\.'bra:ParallelLText,' +\.'bra:ParallelRText,' +\.'nor:ParallelPar,' +\.'nor:tolerance' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/plain b/vim-latex/ftplugin/latex-suite/packages/plain new file mode 100644 index 0000000..6a3d092 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/plain @@ -0,0 +1,10 @@ +if exists("plain_package_file") + finish +endif +let plain_package_file = 1 + +let g:TeX_package_option_plain = '' + +let g:TeX_package_plain = 'env:plain' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/plates b/vim-latex/ftplugin/latex-suite/packages/plates new file mode 100644 index 0000000..e22817e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/plates @@ -0,0 +1,16 @@ +if exists("plates_package_file") + finish +endif +let plates_package_file = 1 + +let g:TeX_package_option_plates = 'figures,onefloatperpage,memoir' + +let g:TeX_package_plates = +\ 'env:plate,' +\.'listofplates,' +\.'ProcessPlates,' +\.'bra:setplatename,' +\.'bra:setplatename,' +\.'bra:atBeginPlates' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/polski b/vim-latex/ftplugin/latex-suite/packages/polski new file mode 100644 index 0000000..e2c4efe --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/polski @@ -0,0 +1,165 @@ +" Author: Mikolaj Machowski <mikmach@wp.pl> +" (c) Copyright by Mikolaj Machowski 2002-2003 +" License: Vim Charityware +" Version: 1.6 +" +" Plik jest w kodowaniu iso-8859-2. Je¶li chcesz go uzywac w MS-Windows musisz +" go przekonwertowac na cp-1250. +" +" Plik ten jest czê¶ci± vim-latexSuite, ale: +" Nie u¿ywaj±cy vim-latexSuite (http://vim-latex.sourceforge.net) mog± wyci±æ +" oznaczon± czê¶æ. Reszta mo¿e byæ kopiowana jako osobny plik pod warunkiem +" niezmieniania tej notki i informacji o prawach autorskich. +" +" This file is in iso-8859-2 encoding. If you want to use it in MS-Windows you +" have to convert it to cp-1250. +" +" This file is part of vim-latexSuite but: +" Those who do not use vim-latexSuite (http://vim-latex.sourceforge.net) can +" cut off marked part. Rest of the file can be copied as separate file under +" condition of leaving this notice and information about copyrights unchanged. + +if exists("acromake_package_file") + finish +endif +let acromake_package_file = 1 + +" --------8<------------- +" Czesc odpowiedzialna za menu +let g:TeX_package_option_polski = +\'OT1,OT4,T1,QX,plmath,nomathsymbols,MeX,prefixingverb,noprefixingverb' +let g:TeX_package_polski = +\'sbr:Dywiz&Ska,'. +\'nor:dywiz,'. +\'nor:ppauza,'. +\'nor:pauza,'. +\'nor:prefixing,'. +\'nor:nonprefixing,'. +\'nor:PLdateending,'. +\'sbr:Matematyka,'. +\'nor:arccos,'. +\'nor:arcctan,'. +\'nor:arcsin,'. +\'nor:arctan,'. +\'nor:cot,'. +\'nor:ctanh,'. +\'nor:tan,'. +\'nor:tanh,'. +\'bra:arc,'. +\'nor:ctg,'. +\'nor:ctgh,'. +\'nor:tg,'. +\'nor:tgh,'. +\'nor:nwd' + +" To wymaga calego pakietu vim-latexSuite - zakomentuj lub wytnij je¶li nie +" u¿ywasz (albo go ¶ci±gnij z http://vim-latex.sf.net) +function! TPackagePolskiTylda() + call IMAP (" ---", "~---", "tex") +endfunction +call TPackagePolskiTylda() +" --------8<------------- + +" Polskie znaki cudzyslowow +TexLet g:Tex_SmartQuoteOpen = ",," +TexLet g:Tex_SmartQuoteClose = "''" + +" Zmodyfikowana i rozwinieta funkcja Andrzeja Ostruszki +" Z dodatkiem od Benjiego Fishera (sprawdzanie sk³adni) +" +" Spacja +inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR> +inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR> + +" Wymuszenie tyldy +inoremap <buffer> <silent> <S-Space> ~ + +" Wymuszenie zwyklej spacji +inoremap <buffer> <silent> <C-Space> <Space> + +" Latwe przelaczanie sie miedzy magiczna spacja a zwykla +inoremap <buffer> <silent> <F8> <C-R>=<SID>TogglePolishSpace()<CR> + +function! s:TogglePolishSpace() + if !exists("b:polishspace") + iunmap <buffer> <Space> + iunmap <buffer> <CR> + let b:polishspace = 1 + return '' + else + inoremap <buffer> <silent> <Space> <C-R>=<SID>Tex_polish_space()<CR> + inoremap <buffer> <silent> <CR> <C-R>=<SID>Tex_polish_space()<CR><BS><CR> + unlet b:polishspace + return '' + endif +endfunction + + +function! s:Tex_polish_space() + "Nic magicznego w matematyce + if synIDattr(synID(line('.'),col('.')-1,0),"name") =~ '^texMath\|^texZone\^texRefZone' + return ' ' + else + let s:col = col('.') + let s:linelength = strlen(getline('.')) + 1 + " Wstaw tylde po spojnikach + if strpart(getline('.'), col('.') - 3, 2) =~? '^[[:space:]~(\[{]\?[aiouwz]$' + return '~' + " Wstaw tylde po inicjalach - konkretnie po pojedynczych wielkich + " literach i kropce. Obs³uguje poprawnie wiekszosc sytuacji. + elseif strpart(getline('.'), col('.') - 4, 3) =~? '^[[:space:]~(\[{]\?\u\.$' + return '~' + " Wstaw tylde po tytulach, skrotach bibliograficznych, podpisach + elseif strpart(getline('.'), col('.') - 9, 8) =~? '\(\s\|^\|\~\)\(str\.\|ryc\.\|rys\.\|tab\.\|art\.\|vol\.\|nr\|tabl\.\|rozdz\.\|ss\.\|s\.\|t\.\|z\.\|sir\|prof\.\|hab\.\|red\.\|min\.\|gen\.\|kpt\.\|przew\.\|p³k\|mjr\|mgr\|bp\|ks\.\|o\+\.\|¶w\.\|dr\)$' + return '~' + " Wstaw tylde miedzy rokiem, wiekiem, a odpowiednim skrotem + elseif strpart(getline('.'), col('.') - 8, 7) =~? '[0-9IVXLCM]\s\+\(r\|w\)\.[^a-z±æê³ñó¶¿¼]\{-}$' + s/[0-9IVXLCM]\zs\s\+\ze\(w\|r\)\.[^a-z±æê³ñó¶¿¼]\{-}\%#/\~/ei + exe 'normal '.s:col.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Wstaw tylde miedzy liczba a miara, itd. + elseif strpart(getline('.'), col('.') - 10, 9) =~? '\(\d\|mln\|mld\|tys\.\)\s\+\(z³\|gr\|ha\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z±æê³ñó¶¿¼]\{-}$' + s/\(\d\|mln\|mld\|tys\.\)\zs\s\+\ze\(z³\|gr\|ha\|m\|t\|mies\|godz\|min\|sek\|cm\|km\|mln\|mld\|tys\.\)[^a-z±æê³ñó¶¿¼]\{-}\%#/\~/ei + exe 'normal '.s:col.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Rozwin myslnik w zbitkach w '\dywiz ': + " bialo-czerwony -> bialo\dywiz czerwony + elseif strpart(getline('.'), col('.') - 20, 19) =~? '[a-z±æê³ñó¶¿¼]-[a-z±æê³ñó¶¿¼]\{-}[^a-z±æê³ñó¶¿¼]\{-}$' + s/[a-z±æê³ñó¶¿¼]\zs-\ze[a-z±æê³ñó¶¿¼]\{-}[^a-z±æê³ñó¶¿¼]\{-}\%#/\\dywiz /ei + let colb = s:col + 6 + exe 'normal '.colb.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + " Rozwin '--' miedzy liczbami w '\ppauza ': + " 39--45 -> 39\ppauza 45 + elseif strpart(getline('.'), col('.') - 10, 9) =~? '[0-9IVXLCM]--[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}$' + s/[0-9IVXLCM]\zs--\ze[0-9IVXLCM]\{-}[^0-9IVXLCM]\{-}\%#/\\ppauza /ei + let colb = s:col + 6 + exe 'normal '.colb.'|' + if s:col == s:linelength + startinsert! + else + startinsert + endif + return ' ' + endif + " Tu koncz komentowanie ostatniej sekcji + endif + return " " +endfunction + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/psgo b/vim-latex/ftplugin/latex-suite/packages/psgo new file mode 100644 index 0000000..1ef852c --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/psgo @@ -0,0 +1,27 @@ +if exists("psgo_package_file") + finish +endif +let psgo_package_file = 1 + +let g:TeX_package_option_psgo = '' + +let g:TeX_package_psgo = +\ 'env:psgogoard,' +\.'env:psgoboard*,' +\.'brs:stone{<+color+>}{<+letter+>}{<+number+>},' +\.'brs:stone[<+marker+>]{<+color+>}{<+letter+>}{<+number+>},' +\.'brs:move{<+letter+>}{<+number+>},' +\.'brs:move*{<+letter+>}{<+number+>},' +\.'brs:goline{<+letter1+>}{<+number1+>}{<+letter2+>}{<+number2+>},' +\.'brs:goarrow{<+letter1+>}{<+number1+>}{<+letter2+>}{<+number2+>},' +\.'sbr:Markers,' +\.'brs:markpos{<+marker+>}{<+letter+>}{<+number+>},' +\.'markma,' +\.'marktr,' +\.'markcr,' +\.'marksq,' +\.'bra:marklb,' +\.'marksl,' +\.'markdd' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/schedule b/vim-latex/ftplugin/latex-suite/packages/schedule new file mode 100644 index 0000000..7d58f6d --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/schedule @@ -0,0 +1,20 @@ +if exists("schedule_package_file") + finish +endif +let schedule_package_file = 1 + +let g:TeX_package_option_schedule = '' + +let g:TeX_package_schedule = +\ 'ens:schedule:[<+title+>],' +\.'bra:CellHeight,' +\.'bra:CellWidth,' +\.'bra:TimeRange,' +\.'bra:SubUnits,' +\.'bra:BeginOn,' +\.'bra:TextSize,' +\.'nor:FiveDay,' +\.'nor:SevenDay,' +\.'brs:NewAppointment{<+name+>}{<+bg+>}{<+fg+>}' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/textfit b/vim-latex/ftplugin/latex-suite/packages/textfit new file mode 100644 index 0000000..4d52785 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/textfit @@ -0,0 +1,12 @@ +if exists("textfit_package_file") + finish +endif +let textfit_package_file = 1 + +let g:TeX_package_option_textfit = '' + +let g:TeX_package_textfit = +\ 'brd:scaletowidth,' +\.'brd:scaletoheight' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/times b/vim-latex/ftplugin/latex-suite/packages/times new file mode 100644 index 0000000..499a13b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/times @@ -0,0 +1,10 @@ +if exists("times_package_file") + finish +endif +let times_package_file = 1 + +let g:TeX_package_option_times = '' + +let g:TeX_package_times = '' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/tipa b/vim-latex/ftplugin/latex-suite/packages/tipa new file mode 100644 index 0000000..c89cc5d --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/tipa @@ -0,0 +1,364 @@ +if exists("tipa_package_file") + finish +endif +let tipa_package_file = 1 + +let g:TeX_package_option_tipa = +\ 'T1,' +\.'noenc,' +\.'tone,' +\.'extra,' +\.'safe' + +let g:TeX_package_tipa = +\ 'sbr:Common,' +\.'bra:textipa,' +\.'env:IPA,' +\.'tipaencoding,' +\.'bra:super,' +\.'nor:ipabar,' +\.'brd:tipalowaraccent,' +\.'brd:tipaupperaccent,' +\.'brd:tipaLowaraccent,' +\.'brd:tipaUpperaccent,' +\.'brd:ipaclap,' +\.'sbr:VowelsandConsonants,' +\.'nor:textturna,' +\.'nor:textrhooka,' +\.'nor:textlhookfour,' +\.'nor:textscripta,' +\.'nor:textturnscripta,' +\.'nor:textinvscripta,' +\.'ae,' +\.'nor:textaolig,' +\.'nor:textsca,' +\.'nor:textinvsca,' +\.'nor:textscaolig,' +\.'nor:textturnv,' +\.'nor:textsoftsign,' +\.'nor:texthardsign,' +\.'nor:texthtb,' +\.'nor:textscb,' +\.'nor:textcrb,' +\.'nor:textbarb,' +\.'nor:textbeta,' +\.'nor:textbarc,' +\.'nor:texthtc,' +\.'bra:v,' +\.'bra:c,' +\.'nor:textctc,' +\.'nor:textstretchc,' +\.'nor:textstretchcvar,' +\.'nor:textctstretchc,' +\.'nor:textctstretchcvar,' +\.'nor:textcrd,' +\.'nor:textbard,' +\.'nor:texthtd,' +\.'nor:textrtaild,' +\.'nor:texthtrtaild,' +\.'nor:textctd,' +\.'nor:textfrhookd,' +\.'nor:textfrhookdvar,' +\.'nor:textdblig,' +\.'nor:textdzlig,' +\.'nor:textdctzlig,' +\.'nor:textdyoghlig,' +\.'nor:textctdctzlig,' +\.'nor:textscdelta,' +\.'nor:dh,' +\.'nor:textrhooke,' +\.'nor:textschwa,' +\.'nor:textrhookschwa,' +\.'nor:textreve,' +\.'nor:textsce,' +\.'nor:textepsilon,' +\.'nor:textrhookepsilon,' +\.'nor:textcloseepsilon,' +\.'nor:textrevepsilon,' +\.'nor:textrhookrevepsilon,' +\.'nor:textcloserevepsilon,' +\.'nor:textscf,' +\.'nor:textscriptg,' +\.'nor:textbarg,' +\.'nor:textcrg,' +\.'nor:texthtg,' +\.'nor:textg,' +\.'nor:textscg,' +\.'nor:texthtscg,' +\.'nor:textgamma,' +\.'nor:textgrgamma,' +\.'nor:textfrtailgamma,' +\.'nor:textbktailgamma,' +\.'nor:textbabygamma,' +\.'nor:textramshorns,' +\.'nor:texthvlig,' +\.'nor:textcrh,' +\.'nor:texthth,' +\.'nor:textrtailhth,' +\.'nor:textheng,' +\.'nor:texththeng,' +\.'nor:textturnh,' +\.'nor:textsch,' +\.'nor:i,' +\.'nor:textbari,' +\.'nor:textiota,' +\.'nor:textlhti,' +\.'nor:textlhtlongi,' +\.'nor:textvibyi,' +\.'nor:textraisevibyi,' +\.'nor:textsci,' +\.'nor:j,' +\.'nor:textctj,' +\.'nor:textctjvar,' +\.'nor:textscj,' +\.'bra:v,' +\.'nor:textbardotlessj,' +\.'nor:textObardotlessj,' +\.'nor:texthtbardotlessj,' +\.'nor:texthtbardotlessjvar,' +\.'nor:texthtk,' +\.'nor:textturnk,' +\.'nor:textsck,' +\.'nor:textturnsck,' +\.'nor:textltilde,' +\.'nor:textbarl,' +\.'nor:textbeltl,' +\.'nor:textrtaill,' +\.'nor:textlyoghlig,' +\.'nor:textOlyoghlig,' +\.'nor:textscl,' +\.'nor:textrevscl,' +\.'nor:textlambda,' +\.'nor:textcrlambda,' +\.'nor:textltailm,' +\.'nor:textturnm,' +\.'nor:textturnmrleg,' +\.'nor:texthmlig,' +\.'nor:textscm,' +\.'nor:textnrleg,' +\.'~,' +\.'nor:textltailn,' +\.'nor:textfrbarn,' +\.'nor:ng,' +\.'nor:textrtailn,' +\.'nor:textctn,' +\.'nor:textnrleg,' +\.'nor:textscn,' +\.'nor:textbullseye,' +\.'nor:textObullseye,' +\.'nor:textbaro,' +\.'nor:o,' +\.'nor:textfemale,' +\.'nor:textuncrfemale,' +\.'nor:oe,' +\.'nor:textscoelig,' +\.'nor:textopeno,' +\.'nor:textrhookopeno,' +\.'nor:textturncelig,' +\.'nor:textomega,' +\.'nor:textinvomega,' +\.'nor:textscomega,' +\.'nor:textcloseomega,' +\.'nor:textlhookp,' +\.'nor:textscp,' +\.'nor:textwynn,' +\.'nor:textthorn,' +\.'nor:textthornvari,' +\.'nor:textthornvarii,' +\.'nor:textthornvariii,' +\.'nor:textthornvariv,' +\.'nor:texthtp,' +\.'nor:textphi,' +\.'nor:texthtq,' +\.'nor:textqplig,' +\.'nor:textscq,' +\.'nor:textfishhookr,' +\.'nor:textlonglegr,' +\.'nor:textrtailr,' +\.'nor:textturnr,' +\.'nor:textturnrrtail,' +\.'nor:textturnlonglegr,' +\.'nor:textscr,' +\.'nor:textinvscr,' +\.'nor:textrevscr,' +\.'bra:v,' +\.'nor:textrtails,' +\.'nor:textesh,' +\.'nor:textdoublebaresh,' +\.'nor:textctesh,' +\.'nor:textlooptoprevesh,' +\.'nor:texthtt,' +\.'nor:textlhookt,' +\.'nor:textrtailt,' +\.'nor:textfrhookt,' +\.'nor:textctturnt,' +\.'nor:texttctclig,' +\.'nor:texttslig,' +\.'nor:textteshlig,' +\.'nor:textturnt,' +\.'nor:textctt,' +\.'nor:textcttctclig,' +\.'nor:texttheta,' +\.'nor:textbaru,' +\.'nor:textupsilon,' +\.'nor:textscu,' +\.'nor:textturnscu,' +\.'nor:textscriptv,' +\.'nor:textturnw,' +\.'nor:textchi,' +\.'nor:textturny,' +\.'nor:textscy,' +\.'nor:textlhtlongy,' +\.'nor:textvibyy,' +\.'nor:textcommatailz,' +\.'bra:v,' +\.'nor:textctz,' +\.'nor:textrtailz,' +\.'nor:textcrtwo,' +\.'nor:textturntwo,' +\.'nor:textyogh,' +\.'nor:textbenttailyogh,' +\.'nor:textrevyogh,' +\.'nor:textctyogh,' +\.'nor:textturnthree,' +\.'nor:textglotstop,' +\.'nor:textraiseglotstop,' +\.'nor:textbarglotstop,' +\.'nor:textinvglotstop,' +\.'nor:textcrinvglotstop,' +\.'nor:textctinvglotstop,' +\.'nor:textrevglotstop,' +\.'nor:textturnglotstop,' +\.'nor:textbarrevglotstop,' +\.'nor:textpipe,' +\.'nor:textpipevar,' +\.'nor:textdoublebarpipe,' +\.'nor:textdoublebarpipevar,' +\.'nor:textdoublepipevar,' +\.'nor:textdoublepipe,' +\.'nor:textdoublebarslash,' +\.'sbr:Suprasegmentals,' +\.'nor:textprimstress,' +\.'nor:textsecstress,' +\.'nor:textlengthmark,' +\.'nor:texthalflength,' +\.'nor:textvertline,' +\.'nor:textdoublevertline,' +\.'bra:textbottomtiebar,' +\.'nor:textdownstep,' +\.'nor:textupstep,' +\.'nor:textglobfall,' +\.'nor:textglobrise,' +\.'nor:textspleftarrow,' +\.'nor:textdownfullarrow,' +\.'nor:textupfullarrow,' +\.'nor:textsubrightarrow,' +\.'nor:textsubdoublearrow,' +\.'sbr:AccentsandDiacritics,' +\.'`,' +\."'," +\.'^,' +\.'~,' +\.'",' +\.'bra:H,' +\.'bra:r,' +\.'bra:v,' +\.'bra:u,' +\.'=,' +\.'.,' +\.'bra:c,' +\.'bra:textpolhook,' +\.'nor:textrevpolhook{o,' +\.'bra:textdoublegrave,' +\.'bra:textsubgrave,' +\.'bra:textsubacute,' +\.'bra:textsubcircum,' +\.'bra:textroundcap,' +\.'bra:textacutemacron,' +\.'bra:textgravemacron,' +\.'bra:textvbaraccent,' +\.'bra:textdoublevbaraccent,' +\.'bra:textgravedot,' +\.'bra:textdotacute,' +\.'bra:textcircumdot,' +\.'bra:texttildedot,' +\.'bra:textbrevemacron,' +\.'bra:textringmacron,' +\.'bra:textacutewedge,' +\.'bra:textdotbreve,' +\.'bra:textsubbridge,' +\.'bra:textinvsubbridge,' +\.'sbr:SubscriptSquare,' +\.'bra:textsubrhalfring,' +\.'bra:textsublhalfring,' +\.'bra:textsubw,' +\.'bra:textoverw,' +\.'bra:textseagull,' +\.'bra:textovercross,' +\.'bra:textsubplus,' +\.'bra:textraising,' +\.'bra:textlowering,' +\.'bra:textadvancing,' +\.'bra:textretracting,' +\.'bra:textsubtilde,' +\.'bra:textsubumlaut,' +\.'bra:textsubring,' +\.'bra:textsubwedge,' +\.'bra:textsubbar,' +\.'bra:textsubdot,' +\.'bra:textsubarch,' +\.'bra:textsyllabic,' +\.'bra:textsuperimposetilde,' +\.'nor:textcorner,' +\.'nor:textopencorner,' +\.'nor:textrhoticity,' +\.'nor:textceltpal,' +\.'nor:textlptr,' +\.'nor:textrptr,' +\.'nor:textrectangle,' +\.'nor:textretractingvar,' +\.'bra:texttoptiebar,' +\.'nor:textrevapostrophe,' +\.'nor:texthooktop,' +\.'nor:textrthook,' +\.'nor:textrthooklong,' +\.'nor:textpalhook,' +\.'nor:textpalhooklong,' +\.'nor:textpalhookvar,' +\.'bra:textsuperscript,' +\.'sbr:ToneLetters,' +\.'bra:tone,' +\.'bra:stone,' +\.'bra:rtone,' +\.'nor:tone{55},' +\.'nor:tone{44},' +\.'nor:tone{33},' +\.'nor:tone{22},' +\.'nor:tone{11},' +\.'nor:tone{51},' +\.'nor:tone{15},' +\.'nor:tone{45},' +\.'nor:tone{12},' +\.'nor:tone{454},' +\.'sbr:DiacriticsExtIPA,' +\.'bra:spreadlips,' +\.'bra:overbridge,' +\.'bra:bibridge,' +\.'bra:subdoublebar,' +\.'bra:subdoublevert,' +\.'bra:subcorner,' +\.'bra:whistle,' +\.'bra:sliding,' +\.'bra:crtilde,' +\.'bra:dottedtilde,' +\.'bra:doubletilde,' +\.'bra:partvoiceless,' +\.'bra:inipartvoiceless,' +\.'bra:finpartvoiceless,' +\.'bra:partvoice,' +\.'bra:inipartvoice,' +\.'bra:finpartvoice,' +\.'bra:sublptr,' +\.'bra:subrptr' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/ulem b/vim-latex/ftplugin/latex-suite/packages/ulem new file mode 100644 index 0000000..9257713 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/ulem @@ -0,0 +1,21 @@ +if exists("ulem_package_file") + finish +endif +let ulem_package_file = 1 + +let g:TeX_package_option_ulem = +\ 'normalem,' +\.'ULforem,' +\.'normalbf,' +\.'UWforbf' + +let g:TeX_package_ulem = +\ 'bra:uwave,' +\.'bra:uline,' +\.'bra:uuline,' +\.'bra:sout,' +\.'bra:xout,' +\.'ULthickness,' +\.'ULdepth' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/url b/vim-latex/ftplugin/latex-suite/packages/url new file mode 100644 index 0000000..642148a --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/url @@ -0,0 +1,24 @@ +if exists("url_package_file") + finish +endif +let url_package_file = 1 + +let g:TeX_package_option_url = +\ 'hyphens,' +\.'obeyspaces,' +\.'spaces,' +\.'T1' + +let g:TeX_package_url = +\ 'bra:urlstyle,' +\.'bra:url,' +\.'bra:path,' +\.'bra:urldef' + +" TODO uncomment if you figure out +" 1. how to get this syn command to work every time instead of only the +" first time this file is sourced. +" syn region texZone start="\\url{" end="}\|%stopzone\>" +" syn region texZone start="\\path{" end="}\|%stopzone\>" + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/verbatim b/vim-latex/ftplugin/latex-suite/packages/verbatim new file mode 100644 index 0000000..f2137ff --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/verbatim @@ -0,0 +1,18 @@ +if exists("verbatim_package_file") + finish +endif +let verbatim_package_file = 1 + +let g:TeX_package_option_verbatim = '' + +let g:TeX_package_verbatim = +\ 'env:comment,' +\.'env:verbatim,' +\.'env:verbatim*,' +\.'bra:verbatiminput,' +\.'bra:verbatiminput' + +syn region texZone start="\\begin{comment}" end="\\end{comment}\|%stopzone\>" fold +syn region texZone start="\\begin{verbatim}" end="\\end{verbatim}\|%stopzone\>" fold + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/packages/version b/vim-latex/ftplugin/latex-suite/packages/version new file mode 100644 index 0000000..4de9da8 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/packages/version @@ -0,0 +1,12 @@ +if exists("version_package_file") + finish +endif +let version_package_file = 1 + +let g:TeX_package_option_version = '' + +let g:TeX_package_version = +\ 'bra:includeversion,' +\.'bra:excludeversion' + +" vim:ft=vim:ff=unix: diff --git a/vim-latex/ftplugin/latex-suite/projecttemplate.vim b/vim-latex/ftplugin/latex-suite/projecttemplate.vim new file mode 100644 index 0000000..1ab4be0 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/projecttemplate.vim @@ -0,0 +1,11 @@ +" Project name +" let g:projName = '' +" +" Project files +" let g:projFiles = '' + + +" Vim settings/maps/abbrs specific for this project + +" Modeline for this file +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:ft=vim diff --git a/vim-latex/ftplugin/latex-suite/pytools.py b/vim-latex/ftplugin/latex-suite/pytools.py new file mode 100644 index 0000000..1934e23 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/pytools.py @@ -0,0 +1,52 @@ +import string, vim, re, os, glob +# catFile: assigns a local variable retval to the contents of a file {{{ +def catFile(filename): + try: + file = open(filename) + lines = ''.join(file.readlines()) + file.close() + except: + lines = '' + + # escape double quotes and backslashes before quoting the string so + # everything passes throught. + vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', lines)) + return lines + +# }}} +# isPresentInFile: check if regexp is present in the file {{{ +def isPresentInFile(regexp, filename): + try: + fp = open(filename) + fcontents = string.join(fp.readlines(), '') + fp.close() + if re.search(regexp, fcontents): + vim.command('let retval = 1') + return 1 + else: + vim.command('let retval = 0') + return None + except: + vim.command('let retval = 0') + return None + +# }}} +# deleteFile: deletes a file if present {{{ +# If the file does not exist, check if its a filepattern rather than a +# filename. If its a pattern, then deletes all files matching the +# pattern. +def deleteFile(filepattern): + if os.path.exists(filepattern): + try: + os.remove(filepattern) + except: + vim.command('let retval = -1') + else: + if glob.glob(filepattern): + for filename in glob.glob(filepattern): + os.remove(filename) + else: + vim.command('let retval = -1') + +# }}} +# vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vim-latex/ftplugin/latex-suite/smartspace.vim b/vim-latex/ftplugin/latex-suite/smartspace.vim new file mode 100644 index 0000000..07526d8 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/smartspace.vim @@ -0,0 +1,102 @@ +"============================================================================= +" File: smartspace.vim +" Author: Carl Muller +" Created: Fri Dec 06 12:00 AM 2002 PST +" +" Description: +" Maps the <space> key in insert mode so that mathematical formulaes are +" always kept on the same line. i.e, $$'s dont get broken across multiple +" lines. +"============================================================================= + +" Avoid reinclusion or if the user doesn't want us. +if exists('b:done_smartspace') + \ || (exists('g:Tex_SmartKeySpace') && !g:Tex_SmartKeySpace) + finish +endif +let b:done_smartspace = 1 + +" Smart space relies on taking over vim's insertion of carriage returns in +" order to keep $$'s on the same line. The only way to get vim not to break +" lines is to set tw=0. +" +" NOTE: setting tw != 0 will break smartspace +" the user's 'tw' setting is still respected in the insert mode. +" However, normal mode actions which rely on 'tw' such as gqap will be +" broken because of the faulty 'tw' setting. +let b:tw = &l:tw +setlocal tw=0 + +inoremap <buffer> <silent> <Space> <Space><Esc>:call <SID>TexFill(b:tw)<CR>a + +" Do not redefine the function. +if exists('*s:TexFill') + finish +endif + +" TexFormatLine: format line retaining $$'s on the same line. {{{ +function! s:TexFill(width) + if a:width != 0 && col(".") > a:width + " For future use, record the current line and the number of the current column + let current_line = getline(".") + let current_column = col(".") + exe "normal! a##\<Esc>" + call <SID>TexFormatLine(a:width,current_line,current_column) + exe "normal! ?##\<CR>2s\<Esc>" + " Remove ## from the search history. + call histdel("/", -1)|let @/=histget("/", -1) + endif +endfunction + +" }}} +function! s:TexFormatLine(width, current_line, current_column) " {{{ + " get the first non-blank character. + let first = matchstr(getline('.'), '\S') + normal! $ + let length = col('.') + let go = 1 + while length > a:width+2 && go + let between = 0 + let string = strpart(getline('.'), 0, a:width) + " Count the dollar signs + let number_of_dollars = 0 + let evendollars = 1 + let counter = 0 + while counter <= a:width-1 + " Pay attention to '$$'. + if string[counter] == '$' && string[counter-1] != '$' + let evendollars = 1 - evendollars + let number_of_dollars = number_of_dollars + 1 + endif + let counter = counter + 1 + endwhile + " Get ready to split the line. + exe 'normal! ' . (a:width + 1) . '|' + if evendollars + " Then you are not between dollars. + exe "normal! ?\\$\\+\\| \<CR>W" + else + " Then you are between dollars. + normal! F$ + if col(".") == 1 || getline('.')[col(".")-1] != "$" + let go = 0 + endif + endif + if first == '$' && number_of_dollars == 1 + let go = 0 + else + exe "normal! i\<CR>\<Esc>$" + " get the first non-blank character. + let first = matchstr(getline('.'), '\S') + endif + let length = col(".") + endwhile + if go == 0 && strpart(a:current_line, 0, a:current_column) =~ '.*\$.*\$.*' + exe "normal! ^f$a\<CR>\<Esc>" + call <SID>TexFormatLine(a:width, a:current_line, a:current_column) + endif +endfunction + +" }}} + +" vim:fdm=marker:ts=4:sw=4:noet diff --git a/vim-latex/ftplugin/latex-suite/templates.vim b/vim-latex/ftplugin/latex-suite/templates.vim new file mode 100644 index 0000000..ad1bbec --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/templates.vim @@ -0,0 +1,148 @@ +"============================================================================= +" File: templates.vim +" Author: Gergely Kontra +" (minor modifications by Srinath Avadhanula) +" (plus other modifications by Mikolaj Machowski) +" Version: 1.0 +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions for handling templates in latex-suite/templates +" directory. +"============================================================================= + +let s:path = fnameescape(expand("<sfile>:p:h")) + +" SetTemplateMenu: sets up the menu for templates {{{ +function! <SID>SetTemplateMenu() + let flist = Tex_FindInRtp('', 'templates') + let i = 1 + while 1 + let fname = Tex_Strntok(flist, ',', i) + if fname == '' + break + endif + exe "amenu ".g:Tex_TemplatesMenuLocation."&".i.":<Tab>".fname." ". + \":call <SID>ReadTemplate('".fname."')<CR>" + let i = i + 1 + endwhile +endfunction + +if g:Tex_Menus + call <SID>SetTemplateMenu() +endif + +" }}} +" ReadTemplate: reads in the template file from the template directory. {{{ +function! <SID>ReadTemplate(...) + if a:0 > 0 + let filename = a:1 + else + let filelist = Tex_FindInRtp('', 'templates') + let filename = + \ Tex_ChooseFromPrompt("Choose a template file:\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or name of file :", + \ filelist, ',') + endif + + let fname = Tex_FindInRtp(filename.'.tex', 'templates', ':p') + call Tex_Debug("0read ".fname, 'templates') + + silent! exe "0read ".fname + + " The first line of the file contains the specifications of what the + " placeholder characters and the other special characters are. + let pattern = '\v(\S+)\t(\S+)\t(\S+)\t(\S+)' + + let s:phsTemp = substitute(getline(1), pattern, '\1', '') + let s:pheTemp = substitute(getline(1), pattern, '\2', '') + let s:exeTemp = substitute(getline(1), pattern, '\3', '') + let s:comTemp = substitute(getline(1), pattern, '\4', '') + + 0 d_ + + call s:ProcessTemplate() + call Tex_pack_updateall(1) + + " Do not handle the placeholders here. Let IMAP_PutTextWithMovement do it + " because it handles UTF-8 character substitutions etc. Therefore delete + " the text into @a and paste it using IMAP_PutTextWithMovement(). + let _a = @a + normal! ggVG"ax + + let _fo = &fo + " Since IMAP_PutTextWithMovement simulates the key-presses, leading + " indendatation can get duplicated in strange ways if ``fo`` is non-empty. + " NOTE: the indentexpr thingie is still respected with an empty fo so that + " environments etc are properly indented. + set fo= + + call Tex_Debug("normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>", 'templates') + exec "normal! i\<C-r>=IMAP_PutTextWithMovement(@a, '".s:phsTemp."', '".s:pheTemp."')\<CR>" + + let &fo = _fo + let @a = _a + + call Tex_Debug('phs = '.s:phsTemp.', phe = '.s:pheTemp.', exe = '.s:exeTemp.', com = '.s:comTemp, 'templates') + +endfunction + +" }}} +" ProcessTemplate: processes the special characters in template file. {{{ +" This implementation follows from Gergely Kontra's +" mu-template.vim +" http://vim.sourceforge.net/scripts/script.php?script_id=222 +function! <SID>ProcessTemplate() + if exists('s:phsTemp') && s:phsTemp != '' + + exec 'silent! %s/^'.s:comTemp.'\(\_.\{-}\)'.s:comTemp.'$/\=<SID>Compute(submatch(1))/ge' + exec 'silent! %s/'.s:exeTemp.'\(.\{-}\)'.s:exeTemp.'/\=<SID>Exec(submatch(1))/ge' + exec 'silent! g/'.s:comTemp.s:comTemp.'/d' + + " A function only puts one item into the search history... + call Tex_CleanSearchHistory() + endif +endfunction + +function! <SID>Exec(what) + exec 'return '.a:what +endfunction + +" Back-Door to trojans !!! +function! <SID>Compute(what) + exe a:what + if exists('s:comTemp') + return s:comTemp.s:comTemp + else + return '' + endif +endfunction + +" }}} +" Command definitions {{{ +if v:version >= 602 + com! -complete=custom,Tex_CompleteTemplateName -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) + \| :startinsert + + " Tex_CompleteTemplateName: for completing names in TTemplate command {{{ + " Description: get list of template names with Tex_FindInRtp(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompleteTemplateName(A,P,L) + " Get name of macros from all runtimepath directories + let tmplnames = Tex_FindInRtp('', 'templates') + " Separate names with \n not , + let tmplnames = substitute(tmplnames,',','\n','g') + return tmplnames + endfunction + " }}} + +else + com! -nargs=? TTemplate :call <SID>ReadTemplate(<f-args>) + \| :startinsert + +endif + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/templates/IEEEtran.tex b/vim-latex/ftplugin/latex-suite/templates/IEEEtran.tex new file mode 100644 index 0000000..104f9b2 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/templates/IEEEtran.tex @@ -0,0 +1,142 @@ +<+ +> !comp! !exe! +%% Based on <bare_jrnl.tex> in the ieee package available from CTAN, +%% I have changed the options so that most useful ones are clubbed together, +%% Have a look at <bare_jrnl.tex> to understand the function of each package. + +%% This code is offered as-is - no warranty - user assumes all risk. +%% Free to use, distribute and modify. + +% *** Authors should verify (and, if needed, correct) their LaTeX system *** +% *** with the testflow diagnostic prior to trusting their LaTeX platform *** +% *** with production work. IEEE's font choices can trigger bugs that do *** +% *** not appear when using other class files. *** +% Testflow can be obtained at: +% http://www.ctan.org/tex-archive/macros/latex/contrib/supported/IEEEtran/testflow + +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[journal]{IEEEtran} + +\usepackage{cite, graphicx, subfigure, amsmath} +\interdisplaylinepenalty=2500 + +% *** Do not adjust lengths that control margins, column widths, etc. *** +% *** Do not use packages that alter fonts (such as pslatex). *** +% There should be no need to do such things with IEEEtran.cls V1.6 and later. + +<++> +% correct bad hyphenation here +\hyphenation{<+op-tical net-works semi-conduc-tor+>} + + +\begin{document} +% +% paper title +\title{<+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>} +% +% +% author names and IEEE memberships +% note positions of commas and nonbreaking spaces ( ~ ) LaTeX will not break +% a structure at a ~ so this keeps an author's name from being broken across +% two lines. +% use \thanks{} to gain access to the first footnote area +% a separate \thanks must be used for each paragraph as LaTeX2e's \thanks +% was not built to handle multiple paragraphs +\author{<+Sumit Bhardwaj+>~\IEEEmembership{<+Student~Member,~IEEE,+>} +<+John~Doe+>,~\IEEEmembership{<+Fellow,~OSA,+>} +<+and~Jane~Doe,+>~\IEEEmembership{<+Life~Fellow,~IEEE+>}}% <-this % stops a space +\thanks{<+Manuscript received January 20, 2002; revised August 13, 2002. +This work was supported by the IEEE.+>}% <-this % stops a space +\thanks{<+S. Bhardwaj is with the Indian Institute of Technology, Delhi.+>} +% +% The paper headers +\markboth{<+Journal of VIM-\LaTeX\ Class Files,~Vol.~1, No.~8,~August~2002+>}{ +<+Bhardwaj \MakeLowercase{\textit{et al.}+>}: <+Skeleton of IEEEtran.cls for Journals in VIM-Latex+>} +% The only time the second header will appear is for the odd numbered pages +% after the title page when using the twoside option. + + +% If you want to put a publisher's ID mark on the page +% (can leave text blank if you just want to see how the +% text height on the first page will be reduced by IEEE) +%\pubid{0000--0000/00\$00.00~\copyright~2002 IEEE} + +% use only for invited papers +%\specialpapernotice{(Invited Paper)} + +% make the title area +\maketitle + + +\begin{abstract} +<+The abstract goes here.+> +\end{abstract} + +\begin{keywords} +<+IEEEtran, journal, \LaTeX, paper, template, VIM, VIM-\LaTeX+>. +\end{keywords} + +\section{Introduction} +\PARstart{<+T+>}{<+his+>} <+demo file is intended to serve as a ``starter file" +for IEEE journal papers produced under \LaTeX\ using IEEEtran.cls version +1.6 and later.+> +% You must have at least 2 lines in the paragraph with the drop letter +% (should never be an issue) +<+May all your publication endeavors be successful.+> + +% needed in second column of first page if using \pubid +%\pubidadjcol + +% trigger a \newpage just before the given reference +% number - used to balance the columns on the last page +% adjust value as needed - may need to be readjusted if +% the document is modified later +%\IEEEtriggeratref{8} +% The "triggered" command can be changed if desired: +%\IEEEtriggercmd{\enlargethispage{-5in}} + +% references section + +%\bibliographystyle{IEEEtran.bst} +%\bibliography{IEEEabrv,../bib/paper} +\begin{thebibliography}{1} + +\bibitem{IEEEhowto:kopka} +H.~Kopka and P.~W. Daly, \emph{A Guide to {\LaTeX}}, 3rd~ed.\hskip 1em plus +0.5em minus 0.4em\relax Harlow, England: Addison-Wesley, 1999. + +\end{thebibliography} + +% biography section +% +\begin{biography}{Sumit Bhardwaj} +Biography text here. +\end{biography} + +% if you will not have a photo +\begin{biographynophoto}{John Doe} +Biography text here. +\end{biographynophoto} + +% insert where needed to balance the two columns on the last page +%\newpage + +\begin{biographynophoto}{Jane Doe} +Biography text here. +\end{biographynophoto} + +% You can push biographies down or up by placing +% a \vfill before or after them. The appropriate +% use of \vfill depends on what kind of text is +% on the last page and whether or not the columns +% are being equalized. + +%\vfill + +% Can be used to pull up biographies so that the bottom of the last one +% is flush with the other column. +%\enlargethispage{-5in} + +\end{document} diff --git a/vim-latex/ftplugin/latex-suite/templates/article.tex b/vim-latex/ftplugin/latex-suite/templates/article.tex new file mode 100644 index 0000000..ea7e1d1 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/templates/article.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper]{article} +\begin{document} +<++> +\end{document} diff --git a/vim-latex/ftplugin/latex-suite/templates/report.tex b/vim-latex/ftplugin/latex-suite/templates/report.tex new file mode 100644 index 0000000..479c7b3 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/templates/report.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper]{report} +\begin{document} +<++> +\end{document} diff --git a/vim-latex/ftplugin/latex-suite/templates/report_two_column.tex b/vim-latex/ftplugin/latex-suite/templates/report_two_column.tex new file mode 100644 index 0000000..15bd95e --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/templates/report_two_column.tex @@ -0,0 +1,9 @@ +<+ +> !comp! !exe! +% File: !comp!expand("%:p:t")!comp! +% Created: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% Last Change: !comp!strftime("%a %b %d %I:00 %p %Y ").substitute(strftime('%Z'), '\<\(\w\)\(\w*\)\>\(\W\|$\)', '\1', 'g')!comp! +% +\documentclass[a4paper,twocolumn]{report} +\begin{document} +<++> +\end{document} diff --git a/vim-latex/ftplugin/latex-suite/texmenuconf.vim b/vim-latex/ftplugin/latex-suite/texmenuconf.vim new file mode 100644 index 0000000..d2c42f3 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/texmenuconf.vim @@ -0,0 +1,130 @@ +"============================================================================= +" File: texmenuconf.vim +" Author: Srinath Avadhanula +" Copyright: Vim charityware license. :help license +" Description: +" +"============================================================================= + +" Paths, crucial for functions +let s:path = fnameescape(expand("<sfile>:p:h")) +let s:up_path = fnameescape(expand("<sfile>:p:h:h")) +let s:mainmenuname = g:Tex_MenuPrefix.'S&uite.' +let s:mapleader = exists('mapleader') ? mapleader : "\\" + +" This glboal variable is incremented each time a top-level latex-suite menu +" is created. We should always use this variable for setting the locations of +" newly created top-level menus. +let g:Tex_NextMenuLocation = g:Tex_MainMenuLocation + +" The templates and macros menus are always nested within the main latex-suit +" menu. +let g:Tex_TemplatesMenuLocation = g:Tex_MainMenuLocation.'.20 '.s:mainmenuname.'&Templates.' +let g:Tex_MacrosMenuLocation = g:Tex_MainMenuLocation.'.20 '.s:mainmenuname.'&Macros.' + +" The packages menu can either be a child of the main menu or be a top-level +" menu by itself. +if g:Tex_NestPackagesMenu + let g:Tex_PackagesMenuLocation = (g:Tex_MainMenuLocation).'.10 '.s:mainmenuname.'&Packages.' +else + let g:Tex_PackagesMenuLocation = (g:Tex_NextMenuLocation).'.10 '.g:Tex_MenuPrefix.'Packages.' + let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 +endif + +" Environments are always a top-level menu. +let g:Tex_EnvMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix.'E&nvironments.' +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + +" Elements are always a top-level menu. +" If we choose to nest elements, then the top-level &TeX-Elements menu +" contains <Fonts / Counters / Dimensions> +" otherwise, the Fonts, Counters and Dimensions menus become top-level menus. +if g:Tex_NestElementMenus + let g:Tex_ElementsMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix.'E&lements.' +else + let g:Tex_ElementsMenuLocation = (g:Tex_NextMenuLocation).'.20 '.g:Tex_MenuPrefix +endif +let g:Tex_NextMenuLocation = g:Tex_NextMenuLocation + 1 + + +" Set up the compiler/viewer menus. {{{ +" +if has('gui_running') && g:Tex_Menus + exec 'anoremenu '.g:Tex_MainMenuLocation.'.25 '. s:mainmenuname.'-sepsuite0- :' + + " menus for compiling / viewing etc. + exec 'anoremenu '.g:Tex_MainMenuLocation.'.30 '.s:mainmenuname.'&Compile<tab>'.s:mapleader.'ll'. + \' :silent! call Tex_RunLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.40 '.s:mainmenuname.'&View<tab>'.s:mapleader.'lv'. + \' :silent! call Tex_ViewLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.50 '.s:mainmenuname.'&Search<tab>'.s:mapleader.'ls'. + \' :silent! call ForwardSearchLaTeX()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.60 '.s:mainmenuname.'&Target\ Format<tab>:TTarget'. + \' :call SetTeXTarget()<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.70 '.s:mainmenuname.'&Compiler\ Target<tab>:TCTarget'. + \' :call Tex_SetTeXCompilerTarget("Compile", "")<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.80 '.s:mainmenuname.'&Viewer\ Target<tab>:TVTarget'. + \' :call Tex_SetTeXCompilerTarget("View", "")<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.90 '.s:mainmenuname.'Set\ &Ignore\ Level<tab>:TCLevel'. + \' :TCLevel<CR>' + exec 'imenu '.g:Tex_MainMenuLocation.'.100 '.s:mainmenuname.'C&omplete\ Ref/Cite'. + \' <Plug>Tex_Completion' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.110 '.s:mainmenuname.'-sepsuite1- :' + " refreshing folds + if g:Tex_Folding + exec 'anoremenu '.g:Tex_MainMenuLocation.'.120 '.s:mainmenuname.'&Refresh\ Folds<tab>'.s:mapleader.'rf'. + \' :call MakeTexFolds(1)<CR>' + exec 'anoremenu '.g:Tex_MainMenuLocation.'.130 '.s:mainmenuname.'-sepsuite2- :' + endif +endif + +" }}} + +" ============================================================================== +" MenuConf: configure the menus as compact/extended, with/without math +" ============================================================================== +function! Tex_MenuConfigure(type, action) " {{{ + let menuloc = s:mainmenuname.'Configure\ Menu.' + if a:type == 'math' + if a:action == 1 + let g:Tex_MathMenus = 1 + exe 'source '.s:path.'/mathmacros.vim' + exe 'amenu disable '.menuloc.'Add\ Math\ Menu' + exe 'amenu enable '.menuloc.'Remove\ Math\ Menu' + elseif a:action == 0 + call Tex_MathMenuRemove() + exe 'amenu enable '.menuloc.'Add\ Math\ Menu' + exe 'amenu disable '.menuloc.'Remove\ Math\ Menu' + endif + elseif a:type == 'elements' + if a:action == 'expand' + let g:Tex_ElementsMenuLocation = '80.20 '.g:Tex_MenuPrefix + exe 'amenu disable '.menuloc.'Expand\ Elements' + exe 'amenu enable '.menuloc.'Compress\ Elements' + elseif a:action == 'nest' + let g:Tex_ElementsMenuLocation = '80.20 '.g:Tex_MenuPrefix.'Elements.' + exe 'amenu enable '.menuloc.'Expand\ Elements' + exe 'amenu disable '.menuloc.'Compress\ Elements' + endif + exe 'source '.fnameescape(s:path.'/elementmacros.vim') + elseif a:type == 'packages' + if a:action == 1 + let g:Tex_PackagesMenu = 1 + exe 'source '.s:path.'/packages.vim' + exe 'amenu disable '.menuloc.'Load\ Packages\ Menu' + endif + endif +endfunction + +" }}} + +" configuration menu. +if g:Tex_Menus + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Add\ Math\ Menu :call Tex_MenuConfigure("math", 1)<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Remove\ Math\ Menu :call Tex_MenuConfigure("math", 0)<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Expand\ Elements :call Tex_MenuConfigure("elements", "expand")<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Compress\ Elements :call Tex_MenuConfigure("elements", "nest")<cr>' + exe 'amenu '.g:Tex_MainMenuLocation.'.900 '.s:mainmenuname.'Configure\ Menu.Load\ Packages\ Menu :call Tex_MenuConfigure("packages", 1)<cr>' +endif + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/texproject.vim b/vim-latex/ftplugin/latex-suite/texproject.vim new file mode 100644 index 0000000..fd1734b --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/texproject.vim @@ -0,0 +1,54 @@ +"============================================================================= +" File: texproject.vim +" Author: Mikolaj Machowski +" Version: 1.0 +" Created: Wen Apr 16 05:00 PM 2003 +" +" Description: Handling tex projects. +"============================================================================= + +let s:path = fnameescape(expand("<sfile>:p:h")) + +command! -nargs=0 TProjectEdit :call <SID>Tex_ProjectEdit() + +" Tex_ProjectEdit: Edit project file " {{{ +" Description: If project file exists (*.latexmain) open it in window created +" with ':split', if no create ':new' window and read there +" project template +" +function! s:Tex_ProjectEdit() + + let file = expand("%:p") + let mainfname = Tex_GetMainFileName() + if glob(mainfname.'.latexmain') != '' + exec 'split '.fnameescape(mainfname.'.latexmain') + else + echohl WarningMsg + echomsg "Master file not found." + echomsg " :help latex-master-file" + echomsg "for more information" + echohl None + endif + +endfunction " }}} +" Tex_ProjectLoad: loads the .latexmain file {{{ +" Description: If a *.latexmain file exists, then sources it +function! Tex_ProjectLoad() + let s:origdir = fnameescape(getcwd()) + exe 'cd '.fnameescape(expand('%:p:h')) + + if glob(Tex_GetMainFileName(':p').'.latexmain') != '' + call Tex_Debug("Tex_ProjectLoad: sourcing [".Tex_GetMainFileName().".latexmain]", "proj") + exec 'source '.fnameescape(Tex_GetMainFileName().'.latexmain') + endif + + exe 'cd '.s:origdir +endfunction " }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug("texproject.vim: catching LatexSuiteFileType event", "proj") | + \ call Tex_ProjectLoad() +augroup END + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/texrc b/vim-latex/ftplugin/latex-suite/texrc new file mode 100644 index 0000000..726c409 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/texrc @@ -0,0 +1,749 @@ +"============================================================================= +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:ff=unix +" File: texrc.vim +" Author: Srinath Avadhanula +" Created: Mon Apr 01 11:00 AM 2002 PST +" +" Description: This file contains resource configuration information for the +" latex-suite package. +" +" NOTE: Do NOT be edit this file directly: +" this file will be over-written each time you install a new copy +" of latex-suite. +" +" You can do one of the following: +" 1. Copy this file into $VIMFILES/ftplugin/tex/texrc +" and edit the values in that file. +" $VIMFILES is ~/.vim for UNIX systems and ~/vimfiles for +" WINDOWS systems. +" +" 2. Just set values of each setting individually in your +" $VIMFILES/ftplugin/tex.vim file. (See above for what +" $VIMFILES is). You will need to use :let instead of :TexLet +" in this case. +" +" NOTE: This file is best viewed with Vim-6.0+ with folding turned on. +"============================================================================= + +" ============================================================================== +" SafeLet: checks for value before giving default value {{{ +" Description: The function takes in a single argument and splits it into 2 +" parts, the first being the first <CWORD> found. this is taken +" as a variable name and the next part is assigned to it +" depending on whether the variable already exists or not. +" handles the case where the next part is quoted or not. +" All these calls work: +" TexLet g:varname = 1 +" TexLet g:varname = '1' +" TexLet g:varname = 'foo bar' +" TexLet g:varname = "foo\nbar" +" TexLet g:varname = foo bar +function! <SID>SafeLet(arg) + let name = matchstr(a:arg, '^\s*\zs\(\S\+\)\ze\s*=') + let value = matchstr(a:arg, '=\s*\zs.*\ze') + let value = substitute(value, '\s*$', '', '') + if !exists(name) + if value =~ "^'\\|^\"" + exec "let ".name." = ".value + else + exe "let ".name." = value" + endif + endif +endfunction +com! -nargs=+ TexLet :call <SID>SafeLet(<q-args>) +" }}} +" ============================================================================== + +" ============================================================================== +" General settings {{{ + +TexLet g:Tex_UsePython = 1 + +" the system command which pulls in a file. +if &shell =~ 'sh' + TexLet g:Tex_CatCmd = 'cat' + TexLet g:Tex_RmCmd = 'rm' +else + TexLet g:Tex_CatCmd = 'type' + TexLet g:Tex_RmCmd = 'del' +endif + +" whether to turn on debugging +TexLet g:Tex_Debug = 0 +" If non empty, all the debugging information will be written to a file of +" this name. +TexLet g:Tex_DebugLog = '' + +" }}} +" ============================================================================== +" Rules: specifications of programs for compiling and viewing {{{ +" + +" By default, when you compile a tex file using \ll, then you will be +" generating a .dvi file. Change this line if you want to set another default. +" NOTE: Make sure that a target for this format exists in the 'Compiler rules' +" section below and is set up properly for your system. +if has('macunix') + TexLet g:Tex_DefaultTargetFormat = 'pdf' +else + TexLet g:Tex_DefaultTargetFormat = 'dvi' +endif + +" A comma seperated list of formats which need multiple compilations to be +" correctly compiled. +TexLet g:Tex_MultipleCompileFormats = 'dvi' + +" Uncomment this line if you compile ps files via dvi files. +" TexLet g:Tex_FormatDependency_ps = 'dvi,ps' + +" ------------------------------------------------------------------------------ +" Compiler rules {{{ +" This is the first thing you should customize. It is set up for most common +" values, but if use some other compiler, then you will want to change this. +" As CompileFlags value you'd perhaps like to use, e.g., '-src-specials', +" but it is known that it can sometimes give different results in the output, +" so use it with care. The '-file-line-error' flag helps sanitize LaTeX error +" messages for processing by Vim. +TexLet g:Tex_CompileRule_dvi = 'latex -interaction=nonstopmode $*' +TexLet g:Tex_EscapeChars = '{}\' + +TexLet g:Tex_CompileRule_ps = 'dvips -Ppdf -o $*.ps $*.dvi' + +" ways to generate pdf files. there are soo many... +" NOTE: pdflatex generates the same output as latex. therefore quickfix is +" possible. +TexLet g:Tex_CompileRule_pdf = 'pdflatex -interaction=nonstopmode $*' + +" TexLet g:Tex_CompileRule_pdf = 'ps2pdf $*.ps' +" TexLet g:Tex_CompileRule_pdf = 'dvipdfm $*.dvi' +" TexLet g:Tex_CompileRule_pdf = 'dvipdf $*.dvi' + +TexLet g:Tex_CompileRule_html = 'latex2html $*.tex' + +TexLet g:Tex_CompileRule_bib = g:Tex_BibtexFlavor . ' $*' + +" Set Tex_UseMakefile to 0 if you want to ignore the presence of a Makefile +" when deciding how to compile +TexLet g:Tex_UseMakefile = 1 + +" }}} +" ------------------------------------------------------------------------------ +" Viewer rules {{{ +" these programs are for viewing other formats. +" NOTE: latex-suite will automatically append file.<format> to these functions +" when calling them. The viewer therefore cannot accept arguments after +" the filename. +" NOTE: Windows users: +" Set your $PATH variable to include the full path to these programs. +if has('win32') + TexLet g:Tex_ViewRule_ps = 'gsview32' + TexLet g:Tex_ViewRule_pdf = 'AcroRd32' + TexLet g:Tex_ViewRule_dvi = 'yap -1' +elseif has('macunix') + " Let the system pick. If you want, you can override the choice here. + TexLet g:Tex_ViewRule_ps = '' + TexLet g:Tex_ViewRule_pdf = '' + " TexLet g:Tex_ViewRule_pdf = 'Acrobat\ Reader\ 5.1' + TexLet g:Tex_ViewRule_dvi = '' + " Set this to 1 to disable opening a viewer with 'open -a' + " Note: If you do this, you need to specify viewers above + " TexLet g:Tex_TreatMacViewerAsUNIX = 1 +else + if executable('xdg-open') + TexLet g:Tex_ViewRule_ps = 'xdg-open' + TexLet g:Tex_ViewRule_pdf = 'xdg-open' + TexLet g:Tex_ViewRule_dvi = 'xdg-open' + else + TexLet g:Tex_ViewRule_ps = 'gv' + TexLet g:Tex_ViewRule_pdf = 'xpdf' + TexLet g:Tex_ViewRule_dvi = 'xdvi' + endif + " the option below specifies an editor for the dvi viewer while starting + " up the dvi viewer according to Dimitri Antoniou's tip on vim.sf.net (tip + " #225) + TexLet g:Tex_UseEditorSettingInDVIViewer = 0 +endif +" For unix systems or macunix systens with enabled Tex_TreatMacViewerAsUNIX: +" Set this to 1 if you do not want to execute the viewer in the background +" TexLet g:Tex_ExecuteUNIXViewerInForeground = 1 + +" Tex_ViewRuleComplete_{format} +" +" If a variable like this is specified, then it takes precedence over the +" variable with the same suffix defined above. i.e, Tex_ViewRuleComplete_dvi +" takes precedence over Tex_ViewRule_dvi. +" +" If only Tex_ViewRule_{format} is specified, then latex-suite constructs the +" actual system command which calls that program automatically. For example, +" if you specify Tex_ViewRule_dvi = 'kdvi', then latex-suite will issue the +" command +" !kdvi --unique file.dvi & +" +" However, if your viewer program accepts the file to be viewed in a way which +" doesn't fit with the way latex-suite constructs the system command, then +" specify it using this variable. You can use the same format here which +" 'makeprg' accepts. So $* can be used in place of the main file name. +" +" IMPORTANT: Make sure you make the process go into the background otherwise +" vim will wait for the viewer to terminate before letting you edit +" the file again. +" +" Example: +" Suppose you have a latex->html converter which converts a file say foo.tex +" to a file foo/index.html. Then you would use: +" +" let g:Tex_ViewRuleComplete_html = 'MozillaFirebird $*/index.html &' +" +" Doing something like this would not be possible using Tex_ViewRule_html +TexLet g:Tex_ViewRuleComplete_dvi = '' + +" }}} +" ------------------------------------------------------------------------------ +" }}} +" ============================================================================== +" Compiler: latex-suite comes with a customizable compiler plugin. {{{ +" :help latex-compiling for a detailed description of these options. +" +" this is the list of patterns which will be ignored from the compiler output. +" This is a handy way of specifying which warnings/errors to ignore. This is a +" list of patterns seperated by '¡' +TexLet g:Tex_IgnoredWarnings = + \'Underfull'."\n". + \'Overfull'."\n". + \'specifier changed to'."\n". + \'You have requested'."\n". + \'Missing number, treated as zero.'."\n". + \'There were undefined references'."\n". + \'Citation %.%# undefined' + +" the 'ignore level' of the 'efm'. A value of 4 says that the first 4 kinds of +" warnings in the list above will be ignored. Use the command TCLevel to set a +" level dynamically. +TexLet g:Tex_IgnoreLevel = 7 + +" NOTE: The values of g:Tex_Flavor and g:Tex_CompilerFlags are provided as a +" way to make compiler/tex.vim standalone. i.e independent of the rest +" of latex-suite. These variables are NOT used if you have already +" defined g:Tex_CompileRule_dvi above. +" +" specifies the current latex flavor. +TexLet g:Tex_Flavor = 'latex' + +" specifies the BibTeX flavor and if necessary options. If you use $* in this +" setting, it will be replaced by the *root* of the main file name, i.e, if +" the main file is "thesis.tex", $* will be "thesis". +TexLet g:Tex_BibtexFlavor = 'bibtex' + +" specifies the MakeIndedx flavor and if necessary options. $* will be +" replaced by the *root* of the main file name. See above. +TexLet g:Tex_MakeIndexFlavor = 'makeindex $*.idx' + +" By default the program described by g:Tex_Flavor above is called with the +" flags '--src-specials --interaction=nonstopmode'. If your particular version +" of latex does not accept these arguments, you will need to set this variable +" to the appropriate value. +" NOTE: leave commented for using the default flags. +" TODO: Is it necessary (or even desirable) to use 2 variables to specify a +" flavor and flags seperately? --SA +" TexLet g:Tex_CompilerFlags = '' + +" If disabled (set to 0) LaTeX-Suite doesn't go immediately to warnings or +" errors after compilation +TexLet g:Tex_GotoError = 1 + +" If set to 1, then latex-suite shows the context of the error in a preview +" window beneath the window showing the actual errors. +TexLet g:Tex_ShowErrorContext = 1 + +" Remove temp files created during part compilations when vim exits. +TexLet g:Tex_RemoveTempFiles = 1 + +" }}} +" ============================================================================== +" Project: how to deal with multi file projects via latex-suite {{{ + +" Use a valid vim expression here if you want to customize the way latex-suite +" searches for a master file from within another file. +TexLet g:Tex_MainFileExpression = '' + +" }}} +" ============================================================================== +" Macros: latex-suite comes with a large number of macros to speed up typing {{{ +" latex. +" +" Place Holder Options: {{{ +" (See |placeholders| for a description of what place-holders are). +" +" these options are actually used by imaps.vim, therefore the prefix is Imap_ +" and not Tex_. See |placeholders| for a description of how to use +" place-holders. You can either completely disable placeholders (not +" recommended) and/or you can change the place holder characters. + +TexLet g:Imap_UsePlaceHolders = 1 +TexLet g:Imap_PlaceHolderStart = '<+' +TexLet g:Imap_PlaceHolderEnd = '+>' + +" This option when set to 1 makes <C-J> in insert mode delete +" non-descriptive (empty) placeholders and enters insert mode. +" NOTE: This option _has_ to be set in the .vimrc. Setting this in a filetype +" plugin file such as ftplugin/tex.vim will not have any affect. +TexLet g:Imap_DeleteEmptyPlaceHolders = 0 + +" When set to 1, in visual mode, <C-J> takes you to the next placeholder +" without deleting the current placeholder. +" NOTE: This option _has_ to be set in the .vimrc. Setting this in a filetype +" plugin file such as ftplugin/tex.vim will not have any affect. +TexLet g:Imap_StickyPlaceHolders = 1 + + +" }}} +" Menu Wizard Option: {{{ +" If the following variable is set to 1, then when an enviroment 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 |placeholders| marking off +" the places where fields need to be filled. +TexLet g:Tex_UseMenuWizard = 0 + +" }}} +" Visual Mode Mapping Correction: {{{ +" 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 +TexLet g:Tex_CatchVisMapErrors = 1 + +" }}} +" Diacritics: {{{ +" whether or not you want to use diacritics +" (diacritics speed up typing some languages. the way they are set up in +" latex-suite is +" =char> = \'{<char>} +" +char> = \v{<char>} +" +} = \"a +" :o = \^o +" Default: 0 +TexLet g:Tex_Diacritics = 0 + +" }}} +" Leader Options: {{{ +" 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. +TexLet g:Tex_Leader = '`' + +" In order to avoid ambiguity between the large number of visual mode macros +" provided, the visual mode macros for environments and sections start with a +" character different from '`'. +TexLet g:Tex_Leader2 = ',' + +" }}} +" Environment Macros: {{{ +" These mappings insert LaTeX "environments" such as +" \begin{center} +" <++> +" \end{center}<++> +" with the cursor left at the first place-holder. +" (See |placeholders| for what these are.) +" Mnemonic: +" 1. All environment mappings begin with 'E' +" 2. The next two capital letters are (for the common environments) the +" first 2 letters of the environment name converted into upper case. For +" example, for the center environment above, use ECE. There are a few +" necessary exceptions such as: +" equation --> EEQ +" eqnarray --> EEA +" Please see texmaps.vim for the complete list. +" +" Along with the insert mode mappings, a set of visual mode mappings is +" provided which encloses the visually selected region in an environment. +" These maps are related to the corresponding insert mode mappings by the +" following rule: +" EFI --> ,fi +" and so on. i.e, the leading E becomes '`' and the next 2 letters are small +" case. Some of the visual mode mappings are sensetive to whether you choose +" line-wise or character wise. For example, if you choose a word and press +" `ve, then you get \verb|word|, whereas if you press `ve on a line-wise +" selection, you get: +" \begin{verbatim} +" line +" \end{verbatim} +" +" these 2 options give finer control on which aspect of the macros you want +" to enable. +TexLet g:Tex_EnvironmentMaps = 1 +TexLet g:Tex_EnvironmentMenus = 1 + + +" }}} +" Font Macros: {{{ +" These mappings insert font descriptions such as: +" \textsf{<++>}<++> +" again with the cursor at the first place-holder. +" Mnemonic: +" 1. first letter is always F (F for font) +" 2. next 2 letters are the 2 letters describing the font. +" +" Example: the above mapping is triggered by FSF. +" +" Just like environment mappings, you can visually select an area and press +" `sf to have it enclosed in: +" \textsf{word} +" or +" {\sffamily +" line +" } +" depending on character-wise or line-wise selection. +TexLet g:Tex_FontMaps = 1 +TexLet g:Tex_FontMenus = 1 + +" }}} +" Section Macros: {{{ +" Inserts LaTeX sections: +" \section +" etc. Just as in the case of environments and fonts, can be enclosed with a +" visual selection. The enclosing is not sensetive to character or line-wise +" selection. +" NOTE: In visual mode, you are supposed to select the name of the section +" etc, not the whole section. +" In the following case, select just the first line, not lines 1-3. +" 1 section name +" 2 some lines in this section +" 3 and some more lines +" Mnemonic: (make your own!) +" SPA for part +" SCH for chapter +" SSE for section +" SSS for subsection +" SS2 for subsubsection +" SPG for paragraph +" SSP for subparagraph +TexLet g:Tex_SectionMaps = 1 +TexLet g:Tex_SectionMenus = 1 + +" }}} +" Auctex Style Mappings: {{{ +" Auctex.vim has heavily inspired various portions of latex-suite providing +" various new ways of conviniently inserting environments. +" +" If you press <F5> in the insert mode while on an empty line, latex-suite +" prompts you with a list of environments you might want to insert. You can +" either choose one from the list or type in a new environment name. +" The variable below (which is a comma seperated list of environment names) +" decides the prompt which latex-suite generates. +" You can place as many items as you want here. If the environment name is a +" standard latex environment such as table or figure, then latex-suite will +" insert a template with additional fields, if not, just a bare bones +" \begin{env} +" <++> +" \end{env} +" is inserted. +" \[ and $$ are also recognized. +" NOTE: Setting this variable to the empty string is a way of leaving the +" <F5> key unmapped + +TexLet g:Tex_PromptedEnvironments = + \ 'eqnarray*,eqnarray,equation,equation*,\[,$$,align,align*' + +" Another quick way of inserting environments is to press one of the shifted +" function keys from <F1> through <F4>. +" Each environment in the following list is mapped to a corresponding shifted +" function key. +" NOTE: Setting this variable to the empty string is a way of leaving all the +" shifted function keys untouched by latex-suite. +" NOTE: Only the first 4 items of the list are used. The rest will be silently +" ignored. +" The number of items in this list decides how many shifted function keys are +" mapped. +TexLet g:Tex_HotKeyMappings = + \ 'eqnarray*,eqnarray,bmatrix' + +" Similar to above mechanisms works <F7> key. It prompts for command with list +" of commands from g:Tex_PromptedCommands. There are not HotKeys for commands. +" It works for commands of style \com{}. Changing of current command is done +" with <S-F7> + +TexLet g:Tex_PromptedCommands = + \ 'footnote,cite,pageref,label' + +" }}} +" Smart Key Mappings: {{{ +" Latex-suite shites with a number of 'smart' maps, where the behavior of +" standard keys is modified in a way which makes editing tex files easy. + +" Pressing <BS> in insert mode checks to see whether we are just after +" something like \'{a} and if so, deletes all of it. i.e, diacritics are +" treated as single characters for backspacing. +" Setting this to zero will leave the <BS> key unmapped. +" Default: 1 +TexLet g:Tex_SmartKeyBS = 1 +" The pattern used to detect whether the previous characters comprise a +" diacritic character. This default pattern detects the standard LaTeX +" diacritics +TexLet g:Tex_SmartBSPattern = + \ '\(' . + \ "\\\\[\"^'=v]{\\S}" . '\|' . + \ "\\\\[\"^'=]\\S" . '\|' . + \ '\\v \S' . '\|' . + \ "\\\\[\"^'=v]{\\\\[iI]}" . '\|' . + \ '\\v \\[iI]' . '\|' . + \ '\\q \S' . '\|' . + \ '\\-' . + \ '\)' . "$" + +" Pressing " (english double quote) will insert `` or '' by making an +" intelligent guess about whether we intended to open or close a quote. +" Default: 1 +TexLet g:Tex_SmartKeyQuote = 1 + +" Users of other languages might want to change the quote characters to suit +" their locale. These global values will be ignored if there are buffer-local +" versions, which may be set in the language-specific package files, such as +" ftplugin/latex-suite/packages/german +TexLet g:Tex_SmartQuoteOpen = "``" +TexLet g:Tex_SmartQuoteClose = "''" + +" Latex-suite maps the <space> key in such a way that $ characters are not +" broken across lines. +" NOTE: Setting this to 1 has the side-effect of making the 'tw' setting be 0. +" Default: +TexLet g:Tex_SmartKeySpace = 0 + +" Pressing ... (3 dots) results in \ldots outside math mode and \cdots in math +" mode. +" +" TODO: Make it more intelligent within math mode. For example +" $1+...+3$ should expand to $1+\cdots+n$, whereas $1,...,n$ should expand +" to $1,\ldots,n$. The amsmath package actually provides a command \dots +" which does this. Maybe use that if amsmath is detected? +" Default: 1 +TexLet g:Tex_SmartKeyDot = 1 + +" }}} +" Advanced Math: {{{ +" These mappings allow for fast inserting of math constructions +" brackets, better handling of space in math mode, unfortunately +" they use <M-> mappings which conflicts with some encodings. This is easy way +" of turning them off. +" +" <M-b> encloses the previous character in \mathbf{} +" <M-c> is polymorphic as follows: +" Insert mode: +" 1. If the previous character is a letter or number, then capitalize it and +" enclose it in \mathcal{} +" 2. otherwise insert \cite{} +" Visual Mode: +" 1. Enclose selection in \mathcal{} +" <M-l> is also polymorphic as follows: +" If the character before typing <M-l> is one of '([{|<q', then do the +" following: +" 1. (<M-l> \left(\right +" similarly for [, | +" {<M-l> \left\{\right\} +" 2. <<M-l> \langle\rangle +" 3. q<M-l> \lefteqn{} +" otherwise insert \label{} +" <M-i> inserts \item commands at the current cursor location depending on +" the surrounding environment. For example, inside itemize, it will +" insert a simple \item, but within a description, it will insert +" \item[<+label+>] etc. +" +" Default: 1 +TexLet g:Tex_AdvancedMath = 1 + +" }}} + +" }}} +" ============================================================================== +" TeX Completion: {{{ + +" Options for controlling the window sizes of the completion windows {{{ + +" The height of the window which contains the \label's (when completing a +" \ref) or bibtex entries (when completing a \cite). This option is used in +" the newer methods of completing \ref's and \cite's. +TexLet g:Tex_OutlineWindowHeight = 15 + +" Options for preview window for ref/cite completion. The next two options +" are used only when g:Tex_UseOutlineCompletion = 0 or +" g:Tex_UseCiteCompletionVer2 = 0, i.e, when we use a classic method of +" completing \refs and \cites. +" Height of cwindow +TexLet g:Tex_ViewerCwindowHeight = 5 +" Height of preview window +TexLet g:Tex_ViewerPreviewHeight = 10 + +" Options for explorer completion. +" Height of explorer window +TexLet g:Tex_ExplorerHeight = 10 + +" Directory for images. Read |latex-completion-explorer| before changing +TexLet g:Tex_ImageDir = '' + +" }}} +" Options for completing a \ref {{{ + +" Whether to use the "outline mode" for displaying the \label's while doing +" \ref completion. In this mode, each label is displayed within the +" document element it resides in. The entire thing is folded to ease +" navigation. Should be easier/faster than the classical mode. +TexLet g:Tex_UseOutlineCompletion = 1 + +" This option should be set via the .latexmain file. It should be a newline +" seperated list of files which make up all the "source" files in the +" current project. This enables latex-suite to skip the more complicated +" algorithm of finding the source files by recursively searching for +" \input'ed files from the |latex-master-file|. +" +" Only used when g:Tex_UseOutlineCompletion = 0. +TexLet g:Tex_ProjectSourceFiles = '' + +" Whether latex-suite simply searches for \\label's in all the .tex file +" found in the current directory or whether it will use a more complex +" algorithm. This is used only g:Tex_UseOutlineCompletion = 0 and +" g:Tex_ProjectSourceFiles = ''. +" See +" :help Tex_UseSimpleLabelSearch +" for more information +TexLet g:Tex_UseSimpleLabelSearch = 0 + +" }}} +" Options for completing a \cite'ation {{{ + +" If set to 1, then the newer way of presenting the bibtex entries is used. +" Instead of a |cwindow| showing just the keys and a synced |preview| +" window beneath, show a single window containing a nicely formatted list +" of bibtex entries. This should be faster and easier to use than the +" classic mode +TexLet g:Tex_UseCiteCompletionVer2 = 1 + +" This is a string which is displayed to the user when he wants to sort or +" filter the bibtex entries. This string also serves to define acronyms for +" the various fields of a bibtex entry. +TexLet g:Tex_BibFieldPrompt = + \ "Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message)\n" . + \ " [t] title [a] author [b] booktitle \n" . + \ " [j] journal [y] year [p] bibtype \n" . + \ " (you can also enter the complete field name) \n" + +" Whether or not to display the string above to aid the user in choosing +" the field to filter/sort with. +TexLet g:Tex_EchoBibFields = 1 + +" A setting of this form defines the letter 'a' as standing for the field +" 'author'. Thus when the user types +" a ellington +" when asked to enter a filter, it is equivalent to the user specifying the +" filter +" author ellington +" TexLet g:Tex_BibAcronym_a = 'author' + +" Whether or not to use Jabref to complete citations +" See +" :help latex-suite-jabref +" for more infomration +TexLet g:Tex_UseJabref = 0 + +" whether or not searches for \cite's are cached. +TexLet g:Tex_RememberCiteSearch = 0 +" Paths to the bibliography files and custom packages. +TexLet g:Tex_BIBINPUTS = '' +TexLet g:Tex_TEXINPUTS = '' + +" }}} + +" }}} +" ============================================================================== +" Menus: set the kinds of menus which you would like to see. {{{ +" +" Setting this variable to zero will immediately disable _all_ menus. +" for finer control set this to 1 and then play with the other options. +" Default: 1 +TexLet g:Tex_Menus = 1 + +" The location of the main menu +TexLet g:Tex_MainMenuLocation = 80 + +" Math contains a large number of tex math elemets such as arrows, +" mathematical fonts (\mathrm), mathematical diacritics (\dot), binary +" relational operators etc. This menu compromises about 75% of the menus. +" Default: 1 +TexLet g:Tex_MathMenus = 1 + +" The following options control the "compactness" of the menus. +" +" Setting this option to 1 makes the Font, Counter and Dimensioning menus to +" be collected together into a single 'Tex-Elements' menu. Setting this to 0 +" creates seperate menus for each of them. +" Default: 1 +TexLet g:Tex_NestElementMenus = 1 + +" Sometimes when you are using a lot of packages with lots of options etc, +" then a lot of time might be spent at startup loading the menus. +" Setting the following variable to 0 will stop autoloading the packages menu. +" You can still goto TeX-Suite.Configure Menu and load this after startup. +" Default: 1 +TexLet g:Tex_PackagesMenu = 1 +" The following option will create the packages option within the TeX-Suite +" menu. +" Default: 1 +TexLet g:Tex_NestPackagesMenu = 1 + +" This is the prefix added to the menu names created by latex suite. Add a +" dot to the following option to nest the menus under the menu name before the +" dot. +" NOTE: With a '.' as the last character of the following setting, every +" single menu created by latex suite will be nested under the same menu. +" Default: 'TeX-' +TexLet g:Tex_MenuPrefix = 'TeX-' + +" Use utf-8 menus. There is plenty of math symbols in LaTeX. It is hard to +" remember them. You can display them with utf-8. Your system/GUI interface +" have to support utf-8. This addition is necessary for resetting 'encoding'. +TexLet g:Tex_UseUtfMenus = 0 + +if g:Tex_UseUtfMenus != 0 && has("gui_running") + set encoding=utf-8 +endif + +" }}} +" ============================================================================== +" Folding: latex-suite comes with 'fake' syntax folding. {{{ +" +" specifies whether the MakeTeXFolds() function will be defined. If this is +" set to zero, then esentially you have disabled all of latex-suite's folding +" functions. no maps for refreshing folds will be set up etc. +" NOTE: However, the function TexFoldTextFunction() is still avaiable +" and 'foldexpr' is set to point to it. This is so you can continue +" using another folding scheme but still use the fold text function. +TexLet g:Tex_Folding = 1 + +" specifies whether a latex file is automatically folded up when opened. +" Setting this to zero means that a file is not folded up as soon as its +" opened. +" NOTE: the MakeTeXFolds() function will still be available (unless disabled +" by g:Tex_Folding), so you can do <F6> or \rf to refresh/create folds. +TexLet g:Tex_AutoFolding = 1 + +" }}} +" ============================================================================== +" Taglist: Support for taglist.vim {{{ +" +" LaTeX-Suite offers now support for taglist.vim, the most popular Vim +" interface for ctags. You should use ctags version >= 5.0 and taglist >= 3.0. +TexLet g:Tex_TaglistSupport = 1 + +" This option turns on definition of tags for LaTeX. +" NOTE: In taglist window you may see duplicate entries for the same tag. It +" means some definitions are repeated somewhere else. You can turn off +" internal definitions or remove external (read ctags description +" where). +TexLet g:Tex_InternalTagsDefinitions = 1 + +" }}} +" ============================================================================== diff --git a/vim-latex/ftplugin/latex-suite/texviewer.vim b/vim-latex/ftplugin/latex-suite/texviewer.vim new file mode 100644 index 0000000..4a1049d --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/texviewer.vim @@ -0,0 +1,1068 @@ +" ============================================================================ +" File: texviewer.vim +" Author: Mikolaj Machowski +" Created: Sun Jan 26 06:00 PM 2003 +" Description: make a viewer for various purposes: \cite{, \ref{ +" License: Vim Charityware License +" Part of vim-latexSuite: http://vim-latex.sourceforge.net +" ============================================================================ +" Tex_SetTexViewerMaps: sets maps for this ftplugin {{{ +function! Tex_SetTexViewerMaps() + inoremap <silent> <Plug>Tex_Completion <Esc>:call Tex_Complete("default","text")<CR> + if !hasmapto('<Plug>Tex_Completion', 'i') + if has('gui_running') + imap <buffer> <silent> <F9> <Plug>Tex_Completion + else + imap <buffer> <F9> <Plug>Tex_Completion + endif + endif +endfunction + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('texviewer.vim: Catching LatexSuiteFileType event', 'view') | + \ call Tex_SetTexViewerMaps() +augroup END + +command -nargs=1 TLook call Tex_Complete(<q-args>, 'tex') +command -nargs=1 TLookAll call Tex_Complete(<q-args>, 'all') +command -nargs=1 TLookBib call Tex_Complete(<q-args>, 'bib') + +" }}} + +" ============================================================================== +" Main completion function +" ============================================================================== +" Tex_Complete: main function {{{ +" Description: +function! Tex_Complete(what, where) + + " Get info about current window and position of cursor in file + let s:winnum = winnr() + + " Change to the directory of the file being edited before running all the + " :grep commands. We will change back to the original directory after we + " finish with the grep. + let s:origdir = fnameescape(getcwd()) + exe 'cd '.fnameescape(expand('%:p:h')) + + let s:pos = Tex_GetPos() + + unlet! s:type + unlet! s:typeoption + + if Tex_GetVarValue('Tex_WriteBeforeCompletion') == 1 + wall + endif + + if a:where == "text" + " What to do after <F9> depending on context + let s:curline = strpart(getline('.'), 0, col('.')) + let s:prefix = matchstr(s:curline, '.*{\zs.\{-}\(}\|$\)') + " a command is of the type + " \psfig[option=value]{figure=} + " Thus + " s:curline = '\psfig[option=value]{figure=' + " (with possibly some junk before \psfig) + " from which we need to extract + " s:type = 'psfig' + " s:typeoption = '[option=value]' + let pattern = '.*\\\(\w\{-}\)\(\[.\{-}\]\)*{\([^ [\]\t]\+\)\?$' + if s:curline =~ pattern + let s:type = substitute(s:curline, pattern, '\1', 'e') + let s:typeoption = substitute(s:curline, pattern, '\2', 'e') + call Tex_Debug('Tex_Complete: s:type = '.s:type.', typeoption = '.s:typeoption, 'view') + endif + + if exists("s:type") && s:type =~ 'ref' + if Tex_GetVarValue('Tex_UseOutlineCompletion') == 1 + call Tex_Debug("Tex_Complete: using outline search method", "view") + call Tex_StartOutlineCompletion() + + elseif Tex_GetVarValue('Tex_UseSimpleLabelSearch') == 1 + call Tex_Debug("Tex_Complete: searching for \\labels in all .tex files in the present directory", "view") + call Tex_Debug("Tex_Complete: silent! grep! ".Tex_EscapeForGrep('\\label{'.s:prefix)." *.tex", 'view') + call Tex_Grep('\\label{'.s:prefix, '*.tex') + call <SID>Tex_SetupCWindow() + + elseif Tex_GetVarValue('Tex_ProjectSourceFiles') != '' + call Tex_Debug('Tex_Complete: searching for \\labels in all Tex_ProjectSourceFiles', 'view') + exec 'cd '.fnameescape(Tex_GetMainFileName(':p:h')) + call Tex_Grep('\\label{'.s:prefix, Tex_GetVarValue('Tex_ProjectSourceFiles')) + call <SID>Tex_SetupCWindow() + + else + call Tex_Debug("Tex_Complete: calling Tex_GrepHelper", "view") + silent! grep! ____HIGHLY_IMPROBABLE___ % + call Tex_GrepHelper(s:prefix, 'label') + call <SID>Tex_SetupCWindow() + endif + + redraw! + + elseif exists("s:type") && s:type =~ 'cite' + + let s:prefix = matchstr(s:prefix, '\([^,]\+,\)*\zs\([^,]\+\)\ze$') + call Tex_Debug(":Tex_Complete: using s:prefix = ".s:prefix, "view") + + if has('python') && Tex_GetVarValue('Tex_UsePython') + \ && Tex_GetVarValue('Tex_UseCiteCompletionVer2') == 1 + + exe 'cd '.s:origdir + silent! call Tex_StartCiteCompletion() + + elseif Tex_GetVarValue('Tex_UseJabref') == 1 + + exe 'cd '.s:origdir + let g:Remote_WaitingForCite = 1 + let citation = input('Enter citation from jabref (<enter> to leave blank): ') + let g:Remote_WaitingForCite = 0 + call Tex_CompleteWord(citation, strlen(s:prefix)) + + else + " grep! nothing % + " does _not_ clear the search history contrary to what the + " help-docs say. This was expected. So use something improbable. + " TODO: Is there a way to clear the search-history w/o making a + " useless, inefficient search? + silent! grep! ____HIGHLY_IMPROBABLE___ % + if g:Tex_RememberCiteSearch && exists('s:citeSearchHistory') + call <SID>Tex_SetupCWindow(s:citeSearchHistory) + else + call Tex_GrepHelper(s:prefix, 'bib') + redraw! + call <SID>Tex_SetupCWindow() + endif + if g:Tex_RememberCiteSearch && &ft == 'qf' + let _a = @a + silent! normal! ggVG"ay + let s:citeSearchHistory = @a + let @a = _a + endif + endif + + elseif exists("s:type") && (s:type =~ 'includegraphics' || s:type == 'psfig') + call Tex_SetupFileCompletion( + \ '', + \ '^\.\\|\.tex$\\|\.bib$\\|\.bbl$\\|\.zip$\\|\.gz$', + \ 'noext', + \ Tex_GetVarValue('Tex_ImageDir', '.'), + \ Tex_GetVarValue('Tex_ImageDir', '')) + + elseif exists("s:type") && s:type == 'bibliography' + call Tex_SetupFileCompletion( + \ '\.b..$', + \ '', + \ 'noext', + \ '.', + \ '') + + elseif exists("s:type") && s:type =~ 'include\(only\)\=' + call Tex_SetupFileCompletion( + \ '\.t..$', + \ '', + \ 'noext', + \ '.', + \ '') + + elseif exists("s:type") && s:type == 'input' + call Tex_SetupFileCompletion( + \ '', + \ '', + \ 'ext', + \ '.', + \ '') + + elseif exists('s:type') && exists("g:Tex_completion_".s:type) + call <SID>Tex_CompleteRefCiteCustom('plugin_'.s:type) + + else + let s:word = expand('<cword>') + if s:word == '' + call Tex_SwitchToInsertMode() + return + endif + call Tex_Debug("silent! grep! ".Tex_EscapeForGrep('\<'.s:word.'\>')." *.tex", 'view') + call Tex_Grep('\<'.s:word.'\>', '*.tex') + + call <SID>Tex_SetupCWindow() + endif + + elseif a:where == 'tex' + " Process :TLook command + call Tex_Grep(a:what, "*.tex") + call <SID>Tex_SetupCWindow() + + elseif a:where == 'bib' + " Process :TLookBib command + call Tex_Grep(a:what, "*.bib") + call Tex_Grepadd(a:what, "*.bbl") + call <SID>Tex_SetupCWindow() + + elseif a:where == 'all' + " Process :TLookAll command + call Tex_Grep(a:what, "*") + call <SID>Tex_SetupCWindow() + endif + +endfunction +" }}} +" Tex_CompleteWord: inserts a word at the chosen location {{{ +" Description: This function is meant to be called when the user press +" ``<enter>`` in one of the [Error List] windows which shows the list of +" matches. completeword is the rest of the word which needs to be inserted. +" prefixlength characters are deleted before completeword is inserted +function! Tex_CompleteWord(completeword, prefixlength) + call Tex_SetPos(s:pos) + + " Complete word, check if add closing } + if a:prefixlength > 0 + if a:prefixlength > 1 + exe 'normal! '.(a:prefixlength-1).'h' + endif + exe 'normal! '.a:prefixlength.'s'.a:completeword."\<Esc>" + else + exe 'normal! a'.a:completeword."\<Esc>" + endif + + if getline('.')[col('.')-1] !~ '{' && getline('.')[col('.')] !~ '}' + exe "normal! a}\<Esc>" + endif + + " Return to Insert mode + call Tex_SwitchToInsertMode() +endfunction " }}} + +" ============================================================================== +" File name completion helper functons +" ============================================================================== +" Tex_SetupFileCompletion: {{{ +" Description: +function! Tex_SetupFileCompletion(accept, reject, ext, dir, root) + call FB_SetVar('FB_AllowRegexp', a:accept) + call FB_SetVar('FB_RejectRegexp', a:reject) + call FB_SetVar('FB_CallBackFunction', 'Tex_CompleteFileName') + call FB_SetVar('FB_CallBackFunctionArgs', '"'.a:ext.'", "'.a:root.'"') + + call FB_OpenFileBrowser(a:dir) +endfunction " }}} +" Tex_CompleteFileName: {{{ +" Description: +function! Tex_CompleteFileName(filename, ext, root) + let root = (a:root == '' ? Tex_GetMainFileName(':p:h') : a:root) + + call Tex_Debug('+Tex_CompleteFileName: getting filename '.a:filename, 'view') + + if a:ext == 'noext' + let completeword = fnamemodify(a:filename, ':r') + else + let completeword = a:filename + endif + let completeword = Tex_RelPath(completeword, root) + + call Tex_Debug(":Tex_CompleteFileName: completing with ".completeword, "view") + call Tex_CompleteWord(completeword, strlen(s:prefix)) +endfunction " }}} +" Tex_Common: common part of strings {{{ +function! s:Tex_Common(path1, path2) + " Assume the caller handles 'ignorecase' + if a:path1 == a:path2 + return a:path1 + endif + let n = 0 + while a:path1[n] == a:path2[n] + let n = n+1 + endwhile + return strpart(a:path1, 0, n) +endfunction " }}} +" Tex_NormalizePath: {{{ +" Description: +function! Tex_NormalizePath(path) + let retpath = a:path + if has("win32") || has("win16") || has("dos32") || has("dos16") + let retpath = substitute(retpath, '\\', '/', 'ge') + endif + if isdirectory(retpath) && retpath !~ '/$' + let retpath = retpath.'/' + endif + return retpath +endfunction " }}} +" Tex_RelPath: ultimate file name {{{ +function! Tex_RelPath(explfilename,texfilename) + let path1 = Tex_NormalizePath(a:explfilename) + let path2 = Tex_NormalizePath(a:texfilename) + + let n = matchend(<SID>Tex_Common(path1, path2), '.*/') + let path1 = strpart(path1, n) + let path2 = strpart(path2, n) + if path2 !~ '/' + let subrelpath = '' + else + let subrelpath = substitute(path2, '[^/]\{-}/', '../', 'ge') + let subrelpath = substitute(subrelpath, '[^/]*$', '', 'ge') + endif + let relpath = subrelpath.path1 + return escape(Tex_NormalizePath(relpath), ' ') +endfunction " }}} + +" ============================================================================== +" Helper functions for dealing with the 'quickfix' and 'preview' windows. +" ============================================================================== +" Tex_SetupCWindow: set maps and local settings for cwindow {{{ +" Description: Set local maps jkJKq<cr> for cwindow. Also size and basic +" settings +" +function! s:Tex_SetupCWindow(...) + call Tex_Debug('+Tex_SetupCWindow', 'view') + cclose + exe 'copen '. g:Tex_ViewerCwindowHeight + " If called with an argument, it means we want to re-use some search + " history from last time. Therefore, just paste it here and proceed. + if a:0 == 1 + set modifiable + % d _ + silent! 0put!=a:1 + $ d _ + endif + setlocal nonumber + setlocal nowrap + + let s:scrollOffVal = &scrolloff + call <SID>Tex_SyncPreviewWindow() + + " If everything went well, then we should be situated in the quickfix + " window. If there were problems, (no matches etc), then we will not be. + " Therefore return. + if &ft != 'qf' + call Tex_Debug('not in quickfix window, quitting', 'view') + return + endif + + nnoremap <buffer> <silent> j j:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> k k:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> <up> <up>:call <SID>Tex_SyncPreviewWindow()<CR> + nnoremap <buffer> <silent> <down> <down>:call <SID>Tex_SyncPreviewWindow()<CR> + + " Change behaviour of <cr> only for 'ref' and 'cite' context. + if exists("s:type") && s:type =~ 'ref\|cite' + exec 'nnoremap <buffer> <silent> <cr> ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':silent! call <SID>Tex_CompleteRefCiteCustom("'.s:type.'")<CR>' + + else + " In other contexts jump to place described in cwindow and close small + " windows + exec 'nnoremap <buffer> <silent> <cr> ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':call <SID>Tex_GoToLocation()<cr>' + + endif + + " Scroll the preview window while in the quickfix window + nnoremap <buffer> <silent> J :wincmd j<cr><c-e>:wincmd k<cr> + nnoremap <buffer> <silent> K :wincmd j<cr><c-y>:wincmd k<cr> + + " Exit the quickfix window without doing anything. + exe 'nnoremap <buffer> <silent> q ' + \ .':set scrolloff='.s:scrollOffVal.'<CR>' + \ .':cd '.s:origdir.'<CR>' + \ .':call Tex_CloseSmallWindows()<CR>' + +endfunction " }}} +" Tex_CompleteRefCiteCustom: complete/insert name for current item {{{ +" Description: handle completion of items depending on current context +" +function! s:Tex_CompleteRefCiteCustom(type) + + let prefixlength=strlen(s:prefix) + if a:type =~ 'cite' + if getline('.') =~ '\\bibitem\s*{' + let bibkey = matchstr(getline('.'), '\\bibitem\s*{\zs.\{-}\ze}') + else + let bibkey = matchstr(getline('.'), '\\bibitem\s*\[.\{-}\]\s*{\zs.\{-}\ze}') + endif + let completeword = bibkey + + elseif a:type =~ 'ref' + let label = matchstr(getline('.'), '\\label{\zs.\{-}\ze}') + let completeword = label + + elseif a:type =~ '^plugin_' + let type = substitute(a:type, '^plugin_', '', '') + let completeword = <SID>Tex_DoCompletion(type) + " use old behaviour for plugins because of backward compatibility + let prefixlength=0 + + endif + + call Tex_CloseSmallWindows() + call Tex_Debug(":Tex_CompleteRefCiteCustom: completing with ".completeword, "view") + call Tex_CompleteWord(completeword, prefixlength) +endfunction " }}} +" Tex_SyncPreviewWindow: synchronize quickfix and preview window {{{ +" Description: Usually quickfix engine takes care about most of these things +" but we discard it for better control of events. +" +function! s:Tex_SyncPreviewWindow() + call Tex_Debug('+Tex_SyncPreviewWindow', 'view') + + let viewfile = matchstr(getline('.'), '^\f*\ze|\d') + let viewline = matchstr(getline('.'), '|\zs\d\+\ze') + + " Hilight current line in cwindow + " Normally hightlighting is done with quickfix engine but we use something + " different and have to do it separately + syntax clear + runtime syntax/qf.vim + exe 'syn match vTodo /\%'. line('.') .'l.*/' + hi link vTodo Todo + + " Close preview window and open it again in new place + pclose + exe 'silent! bot pedit +'.viewline.' '.viewfile + + " Vanilla 6.1 has bug. This additional setting of cwindow height prevents + " resizing of this window + exe g:Tex_ViewerCwindowHeight.' wincmd _' + + " Handle situation if there is no item beginning with s:prefix. + " Unfortunately, because we know it late we have to close everything and + " return as in complete process + if v:errmsg =~ 'E32\>' + exe s:winnum.' wincmd w' + pclose! + cclose + if exists("s:prefix") + echomsg 'No bibkey, label or word beginning with "'.s:prefix.'"' + endif + call Tex_SwitchToInsertMode() + let v:errmsg = '' + call Tex_Debug('Tex_SyncPreviewWindow: got error E32, no matches found, quitting', 'view') + return 0 + endif + + " Move to preview window. Really is it under cwindow? + wincmd j + + " Settings of preview window + exe g:Tex_ViewerPreviewHeight.' wincmd _' + setlocal nofoldenable + + if exists('s:type') && s:type =~ 'cite' + " In cite context place bibkey at the top of preview window. + setlocal scrolloff=0 + normal! zt + else + " In other contexts in the middle. Highlight this line? + setlocal scrolloff=100 + normal! z. + endif + + " Return to cwindow + wincmd p + +endfunction " }}} +" Tex_CloseSmallWindows: {{{ +" Description: +" +function! Tex_CloseSmallWindows() + exe s:winnum.' wincmd w' + pclose! + cclose + call Tex_SetPos(s:pos) +endfunction " }}} +" Tex_GoToLocation: Go to chosen location {{{ +" Description: Get number of current line and go to this number +" +function! s:Tex_GoToLocation() + pclose! + let errmsg = v:errmsg + let v:errmsg = '' + exe 'silent! cc ' . line('.') + " If the current buffer is modified, then split + if v:errmsg =~ '^E37:' + split + exe 'silent! cc ' . line('.') + endif + cclose + let v:errmsg = errmsg +endfunction " }}} + +" ============================================================================== +" Functions for finding \\label's or \\bibitem's in the main file. +" ============================================================================== +" Tex_GrepHelper: grep main filename for \\bibitem's or \\label's {{{ +" Description: +function! Tex_GrepHelper(prefix, what) + let _path = &path + let _suffixesadd = &suffixesadd + let _hidden = &hidden + + let mainfname = Tex_GetMainFileName(':p') + " If we are already editing the file, then use :split without any + " arguments so it works even if the file is modified. + " FIXME: If mainfname is being presently edited in another window and + " is 'modified', then the second split statement will not work. + " We will need to travel to that window and back. + if mainfname == expand('%:p') + split + else + exec 'split '.fnameescape(mainfname) + endif + + let pos = Tex_GetPos() + if a:what =~ 'bib' + call Tex_ScanFileForCite(a:prefix) + else + call Tex_ScanFileForLabels(a:prefix) + endif + call Tex_SetPos(pos) + + q + let &path = _path + let &suffixesadd = _suffixesadd + +endfunction " }}} +" Tex_ScanFileForCite: search for \bibitem's in .bib or .bbl or tex files {{{ +" Description: +" Search for bibliographic entries in the presently edited file in the +" following manner: +" 1. First see if the file has a \bibliography command. +" If YES: +" 1. If a .bib file corresponding to the \bibliography command can be +" found, then search for '@.*'.a:prefix inside it. +" 2. Otherwise, if a .bbl file corresponding to the \bibliography command +" can be found, then search for '\bibitem'.a:prefix inside it. +" 2. Next see if the file has a \thebibliography environment +" If YES: +" 1. Search for '\bibitem'.a:prefix in this file. +" +" If neither a \bibliography or \begin{thebibliography} are found, then repeat +" steps 1 and 2 for every file \input'ed into this file. Abort any searching +" as soon as the first \bibliography or \begin{thebibliography} is found. +function! Tex_ScanFileForCite(prefix) + call Tex_Debug('+Tex_ScanFileForCite: searching for bibkeys in '.bufname('%').' (buffer #'.bufnr('%').')', 'view') + let presBufNum = bufnr('%') + + let foundCiteFile = 0 + " First find out if this file has a \bibliography command in it. If so, + " assume that this is the only file in the project which defines a + " bibliography. + if search('\\\(no\)\?bibliography{', 'w') + call Tex_Debug('Tex_ScanFileForCite: found bibliography command in '.bufname('%'), 'view') + " convey that we have found a bibliography command. we do not need to + " proceed any further. + let foundCiteFile = 1 + + " extract the bibliography filenames from the command. + let bibnames = matchstr(getline('.'), '\\\(no\)\?bibliography{\zs.\{-}\ze}') + let bibnames = substitute(bibnames, '\s', '', 'g') + + call Tex_Debug('trying to search through ['.bibnames.']', 'view') + + let &path = '.,'.g:Tex_BIBINPUTS + + let i = 1 + while 1 + let bibname = Tex_Strntok(bibnames, ',', i) + if bibname == '' + break + endif + + " first try to find if a .bib file exists. If so do not search in + " the corresponding .bbl file. (because the .bbl file will most + " probly be generated automatically from the .bib file with + " bibtex). + + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bib') + if fname != '' + call Tex_Debug('finding .bib file ['.bufname('%').']', 'view') + exec 'split '.Tex_EscapeSpaces(fname) + call Tex_Grepadd('@.*{'.a:prefix, "%") + q + else + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bbl') + if fname != '' + exec 'split '.Tex_EscapeSpaces(fname) + call Tex_Debug('finding .bbl file ['.bufname('.').']', 'view') + call Tex_Grepadd('\\bibitem{'.a:prefix, "%") + q + endif + endif + + let i = i + 1 + endwhile + + if foundCiteFile + return 1 + endif + endif + + " If we have a thebibliography environment, then again assume that this is + " the only file which defines the bib-keys. Aand convey this information + " upwards by returning 1. + if search('^\s*\\begin{thebibliography}', 'w') + call Tex_Debug('got a thebibliography environment in '.bufname('%'), 'view') + + let foundCiteFile = 1 + + split + exec 'lcd'.fnameescape(expand('%:p:h')) + call Tex_Debug("silent! grepadd! ".Tex_EscapeForGrep('\\bibitem{'.a:prefix)." %", 'view') + call Tex_Grepadd('\\bibitem\s*[\[|{]'.a:prefix, "%") + q + + return 1 + endif + + " If we have not found any \bibliography or \thebibliography environment + " in this file, search for these environments in all the files which this + " file includes. + + exec 0 + let wrap = 'w' + while search('^\s*\\\(input\|include\)', wrap) + let wrap = 'W' + + let filename = matchstr(getline('.'), '\\\(input\|include\){\zs.\{-}\ze}') + + let foundfile = Tex_FindFile(filename, '.,'.g:Tex_TEXINPUTS, '.tex') + if foundfile != '' + exec 'split '.Tex_EscapeSpaces(foundfile) + call Tex_Debug('scanning recursively in ['.foundfile.']', 'view') + let foundCiteFile = Tex_ScanFileForCite(a:prefix) + q + endif + + if foundCiteFile + return 1 + endif + endwhile + + + return 0 +endfunction " }}} +" Tex_ScanFileForLabels: greps present file and included files for \\label's {{{ +" Description: +" Grep the presently edited file for \\label's. If the present file \include's +" or \input's other files, then recursively scan those as well, i.e we support +" arbitrary levels of \input'ed-ness. +function! Tex_ScanFileForLabels(prefix) + call Tex_Debug("+Tex_ScanFileForLabels: grepping in file [".bufname('%')."]", "view") + + exec 'lcd'.fnameescape(expand('%:p:h')) + call Tex_Grepadd('\\label{'.a:prefix, "%") + + " Then recursively grep for all \include'd or \input'ed files. + exec 0 + let wrap = 'w' + while search('^\s*\\\(input\|include\)', wrap) + let wrap = 'W' + + let filename = matchstr(getline('.'), '\\\(input\|include\){\zs.\{-}\ze}') + let foundfile = Tex_FindFile(filename, '.,'.Tex_TEXINPUTS, '.tex') + if foundfile != '' + exec 'split '.Tex_EscapeSpaces(foundfile) + call Tex_Debug('Tex_ScanFileForLabels: scanning recursively in ['.foundfile.']', 'view') + call Tex_ScanFileForLabels(a:prefix) + q + endif + endwhile + +endfunction " }}} + +" ============================================================================== +" Functions for custom command completion +" ============================================================================== +" Tex_completion_{var}: similar variables can be set in package files {{{ +let g:Tex_completion_bibliographystyle = 'abbr,alpha,plain,unsrt' +let g:Tex_completion_addtocontents = 'lof}{,lot}{,toc}{' +let g:Tex_completion_addcontentsline = 'lof}{figure}{,lot}{table}{,toc}{chapter}{,toc}{part}{,'. + \ 'toc}{section}{,toc}{subsection}{,toc}{paragraph}{,'. + \ 'toc}{subparagraph}{' +" }}} +" Tex_PromptForCompletion: prompts for a completion {{{ +" Description: +function! s:Tex_PromptForCompletion(texcommand,ask) + + let common_completion_prompt = + \ Tex_CreatePrompt(g:Tex_completion_{a:texcommand}, 2, ',') . "\n" . + \ 'Enter number or completion: ' + + let inp = input(a:ask."\n".common_completion_prompt) + if inp =~ '^[0-9]\+$' + let completion = Tex_Strntok(g:Tex_completion_{a:texcommand}, ',', inp) + else + let completion = inp + endif + + return completion +endfunction " }}} +" Tex_DoCompletion: fast insertion of completion {{{ +" Description: +" +function! s:Tex_DoCompletion(texcommand) + let completion = <SID>Tex_PromptForCompletion(a:texcommand, 'Choose a completion to insert: ') + if completion != '' + return completion + else + return '' + endif +endfunction " }}} + +" ============================================================================== +" Functions for presenting an outlined version for completion +" ============================================================================== +" Tex_StartOutlineCompletion: sets up an outline window {{{ + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +let s:path = expand('<sfile>:p:h') +if has('python') && Tex_GetVarValue('Tex_UsePython') + python import sys, re + exec "python sys.path += [r'". s:path . "']" + python import outline +endif + +function! Tex_StartOutlineCompletion() + let mainfname = Tex_GetMainFileName(':p') + + " open the buffer + let _report = &report + let _cmdheight=&cmdheight + let _lazyredraw = &lazyredraw + set report=1000 + set cmdheight=1 + set lazyredraw + + if has('python') && Tex_GetVarValue('Tex_UsePython') + python retval = outline.main(vim.eval("Tex_GetMainFileName(':p')"), vim.eval("s:prefix")) + + " transfer variable from python to a local variable. + python vim.command("""let retval = "%s" """ % re.sub(r'"|\\', r'\\\g<0>', retval)) + else + let retval = system(shellescape(s:path.'/outline.py').' '.shellescape(mainfname).' '.shellescape(s:prefix)) + endif + + bot split __OUTLINE__ + exec Tex_GetVarValue('Tex_OutlineWindowHeight', 15).' wincmd _' + + setlocal modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldmethod=marker + setlocal foldmarker=<<<,>>> + + " delete everything in it to the blackhole + % d _ + 0put!=retval + + 0 + + call Tex_SetupOutlineSyntax() + + exec 'nnoremap <buffer> <cr> ' + \ .':cd '.s:origdir.'<CR>' + \ .':call Tex_FinishOutlineCompletion()<CR>' + exec 'nnoremap <buffer> q ' + \ .':cd '.s:origdir.'<CR>' + \ .':close<CR>' + \ .':call Tex_SwitchToInsertMode()<CR>' + + " once the buffer is initialized, go back to the original settings. + setlocal nomodifiable + setlocal nomodified + let &report = _report + let &cmdheight = _cmdheight + let &lazyredraw = _lazyredraw + +endfunction " }}} +" Tex_SetupOutlineSyntax: sets up the syntax items for the outline {{{ +" Description: +function! Tex_SetupOutlineSyntax() + syn match outlineFileName "<\f\+>$" contained + syn match foldMarkers "<<<\d$" contained + syn match firstSemiColon '^:' contained + syn match firstAngle '^>' contained + + syn match sectionNames '\(\d\.\)\+ .*' contains=foldMarkers + syn match previousLine '^:.*' contains=firstSemiColon + syn match labelLine '^>.*' contains=firstAngle,outlineFileName + + hi def link outlineFileName Ignore + hi def link foldMarkers Ignore + hi def link firstSemiColon Ignore + hi def link firstAngle Ignore + + hi def link sectionNames Type + hi def link previousLine Special + hi def link labelLine Comment +endfunction " }}} +" Tex_FinishOutlineCompletion: inserts the reference back in the text {{{ +function! Tex_FinishOutlineCompletion() + if getline('.') !~ '^[>:]' + return + endif + + if getline('.') =~ '^>' + let ref_complete = matchstr(getline('.'), '^>\s\+\zs\S\+\ze') + elseif getline('.') =~ '^:' + let ref_complete = matchstr(getline(line('.')-1), '^>\s\+\zs\S\+\ze') + endif + + close + call Tex_CompleteWord(ref_complete, strlen(s:prefix)) +endfunction " }}} + +" ============================================================================== +" Functions for presenting a nicer list of bibtex entries +" ============================================================================== +" Tex_FindBibFiles: finds all .bib files used by the main file {{{ +" Description: +function! Tex_FindBibFiles() + call Tex_Debug(":Tex_FindBibFiles: ", "view") + + let mainfname = Tex_GetMainFileName(':p') + wincmd n + exec 'silent! e '.fnameescape(mainfname) + + if search('\\\(no\)\?bibliography{', 'w') + + call Tex_Debug('Tex_FindBibFiles: found bibliography command in '.bufname('%'), 'view') + + " extract the bibliography filenames from the command. + let bibnames = matchstr(getline('.'), '\\\(no\)\?bibliography{\zs.\{-}\ze}') + let bibnames = substitute(bibnames, '\s', '', 'g') + + call Tex_Debug(':Tex_FindBibFiles: trying to search through ['.bibnames.']', 'view') + + let bibfiles = '' + let i = 1 + while 1 + let bibname = Tex_Strntok(bibnames, ',', i) + if bibname == '' + break + endif + let fname = Tex_FindFile(bibname, '.,'.g:Tex_BIBINPUTS, '.bib') + if fname != '' + let bibfiles = bibfiles.fname."\n" + endif + let i = i + 1 + endwhile + + call Tex_Debug(":Tex_FindBibFiles: returning [".bibfiles."]", "view") + q + return bibfiles + + else + q + return '' + endif + +endfunction " }}} +" Tex_StartBibtexOutline: sets up an outline window {{{ + +" get the place where this plugin resides for setting cpt and dict options. +" these lines need to be outside the function. +if has('python') && Tex_GetVarValue('Tex_UsePython') + python import sys, re + exec "python sys.path += [r'". s:path . "']" + python import bibtools +endif + +function! Tex_StartCiteCompletion() + let bibfiles = Tex_FindBibFiles() + if bibfiles !~ '\S' + call Tex_SwitchToInsertMode() + echohl WarningMsg + echomsg 'No bibfiles found! Sorry' + echohl None + return + endif + + bot split __OUTLINE__ + exec Tex_GetVarValue('Tex_OutlineWindowHeight', 15).' wincmd _' + + exec 'python Tex_BibFile = bibtools.BibFile("""'.bibfiles.'""")' + exec 'python Tex_BibFile.addfilter("key ^'.s:prefix.'")' + call Tex_DisplayBibList() + + nnoremap <Plug>Tex_JumpToNextBibEntry :call search('^\S.*\]$', 'W')<CR>:call Tex_EchoBibShortcuts()<CR>z. + nnoremap <Plug>Tex_JumpToPrevBibEntry :call search('^\S.*\]$', 'bW')<CR>:call Tex_EchoBibShortcuts()<CR>z. + nnoremap <Plug>Tex_FilterBibEntries :call Tex_HandleBibShortcuts('filter')<CR> + nnoremap <Plug>Tex_RemoveBibFilters :call Tex_HandleBibShortcuts('remove_filters')<CR> + nnoremap <Plug>Tex_SortBibEntries :call Tex_HandleBibShortcuts('sort')<CR> + nnoremap <Plug>Tex_CompleteCiteEntry :call Tex_CompleteCiteEntry()<CR> + + nmap <buffer> <silent> n <Plug>Tex_JumpToNextBibEntry + nmap <buffer> <silent> p <Plug>Tex_JumpToPrevBibEntry + nmap <buffer> <silent> f <Plug>Tex_FilterBibEntries + nmap <buffer> <silent> s <Plug>Tex_SortBibEntries + nmap <buffer> <silent> a <Plug>Tex_RemoveBibFilters + nmap <buffer> <silent> q :close<CR>:call Tex_SwitchToInsertMode()<CR> + nmap <buffer> <silent> <CR> <Plug>Tex_CompleteCiteEntry + +endfunction " }}} +" Tex_DisplayBibList: displays the list of bibtex entries {{{ +" Description: +function! Tex_DisplayBibList() + " open the buffer + let _report = &report + let _cmdheight=&cmdheight + let _lazyredraw = &lazyredraw + set report=1000 + set cmdheight=1 + set lazyredraw + + setlocal modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + setlocal nowrap + setlocal foldmethod=marker + setlocal foldmarker=<<<,>>> + + + " delete everything in it to the blackhole + % d _ + + exec 'python Tex_CurBuf = vim.current.buffer' + exec 'python Tex_CurBuf[:] = str(Tex_BibFile).splitlines()' + + call Tex_SetupBibSyntax() + + 0 + call Tex_EchoBibShortcuts() + + " once the buffer is initialized, go back to the original settings. + setlocal nomodifiable + setlocal nomodified + let &report = _report + let &cmdheight = _cmdheight + let &lazyredraw = _lazyredraw + +endfunction " }}} +" Tex_EchoBibShortcuts: echos all the shortcuts in the status line {{{ +" Description: +function! Tex_EchoBibShortcuts() + echomsg '(a) all (f) filter (s) sort (n) next (p) previous (q) quit (<CR>) choose' +endfunction " }}} +" Tex_SetupBibSyntax: sets up the syntax items for the outline {{{ +" Description: +function! Tex_SetupBibSyntax() + syn match BibTitleHeader "^TI" contained + syn match BibAuthorHeader "^AU" contained + syn match BibLocationHeader "^IN" contained + syn match BibMiscHeader "^MI" contained + + syn match BibKeyLine '^\S.*\]$' contains=BibKey + syn match BibTitle "^TI .*" contains=BibTitleHeader + syn match BibAuthor "^AU .*" contains=BibAuthorHeader + syn match BibLocation "^IN .*" contains=BibLocationHeader + syn match BibMisc "^MI .*" contains=BibMiscHeader + + hi def link BibTitleHeader Ignore + hi def link BibAuthorHeader Ignore + hi def link BibLocationHeader Ignore + hi def link BibMiscHeader Ignore + + hi def link BibKeyLine Visual + hi def link BibTitle Type + hi def link BibAuthor Special + hi def link BibLocation Comment + hi def link BibMisc Comment +endfunction " }}} +" Tex_HandleBibShortcuts: handles user keypresses {{{ +" Description: +function! Tex_HandleBibShortcuts(command) + + if a:command == 'filter' || a:command == 'sort' + + let fieldprompt = + \ "Field acronyms: (`:let g:Tex_EchoBibFields = 0` to avoid this message)\n" . + \ " [t] title [a] author [b] booktitle \n" . + \ " [j] journal [y] year [p] bibtype \n" . + \ " (you can also enter the complete field name) \n" + + let fieldprompt = Tex_GetVarValue('Tex_BibFieldPrompt', fieldprompt) + + if Tex_GetVarValue('Tex_EchoBibFields', 1) == 1 + echo fieldprompt + endif + + let inp = input('Enter '.a:command.' criterion [field<space>value]: ') + if inp !~ '\v^\S+\s+\S.*' + echohl WarningMsg + echomsg 'Invalid filter specification. Use "field<space>value"' + echohl None + return + endif + + if inp != '' + " If the field is specified as a single character, then replace + " it with the corresponding 'full form'. + if inp =~ '^[a-z]\>' + if Tex_GetVarValue('Tex_BibAcronym_'.inp[0]) != '' + let inp = substitute(inp, '.', Tex_GetVarValue('Tex_BibAcronym_'.inp[0]), '') + elseif fieldprompt =~ '\['.inp[0].'\]' + let full = matchstr(fieldprompt, '\['.inp[0].'\] \zs\w\+\ze') + let inp = substitute(inp, '.', full, '') + endif + endif + call Tex_Debug(":Tex_HandleBibShortcuts: using inp = [".inp."]", "view") + if a:command == 'filter' + exec 'python Tex_BibFile.addfilter("'.inp.'")' + elseif a:command == 'sort' + exec "python Tex_BibFile.addsortfield(\"".inp."\")" + exec 'python Tex_BibFile.sort()' + endif + silent! call Tex_DisplayBibList() + endif + + elseif a:command == 'remove_filters' + + exec 'python Tex_BibFile.rmfilters()' + exec 'python Tex_BibFile.addfilter("key ^'.s:prefix.'")' + call Tex_DisplayBibList() + + endif + +endfunction " }}} +" Tex_CompleteCiteEntry: completes cite entry {{{ +" Description: +function! Tex_CompleteCiteEntry() + normal! 0 + call search('\[\S\+\]$', 'W') + if getline('.') !~ '\[\S\+\]$' + call search('\[\S\+\]$', 'bW') + endif + + if getline('.') !~ '\[\S\+\]$' + return + endif + + let ref = matchstr(getline('.'), '\[\zs\S\+\ze\]$') + close + call Tex_Debug(":Tex_CompleteCiteEntry: completing with ".ref, "view") + call Tex_CompleteWord(ref, strlen(s:prefix)) +endfunction " }}} + +" Tex_SwitchToInsertMode: Switch to insert mode {{{ +" Description: This is usually called when completion is finished +function! Tex_SwitchToInsertMode() + call Tex_Debug(":Tex_SwitchToInsertMode: ", "view") + if col('.') == strlen(getline('.')) + startinsert! + else + normal! l + startinsert + endif +endfunction " }}} + +com! -nargs=0 TClearCiteHist unlet! s:citeSearchHistory + +" vim:fdm=marker:nowrap:noet:ff=unix:ts=4:sw=4 diff --git a/vim-latex/ftplugin/latex-suite/version.vim b/vim-latex/ftplugin/latex-suite/version.vim new file mode 100644 index 0000000..3da5ef4 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/version.vim @@ -0,0 +1,30 @@ +" Tex_Version: returns a string which gives the current version number of latex-suite +" Description: +" Each time a bug fix/addition is done in any source file in latex-suite, +" not just this file, the number below has to be incremented by the author. +" This will ensure that there is a single 'global' version number for all of +" latex-suite. +" +" If a change is done in the doc/ directory, i.e an addition/change in the +" documentation, then this number should NOT be incremented. +" +" Latex-suite will follow a 3-tier system of versioning just as Vim. A +" version number will be of the form: +" +" X.Y.ZZ +" +" 'X' will only be incremented for a major over-haul or feature addition. +" 'Y' will be incremented for significant changes which do not qualify +" as major. +" 'ZZ' will be incremented for bug-fixes and very trivial additions such +" as adding an option etc. Once ZZ reaches 50, then Y will be +" incremented and ZZ will be reset to 01. Each time we have a +" version number of the form X.Y.01, then we'll make a release on +" vim.sf.net and also create a cvs tag at that point. We'll try to +" "stabilize" that version by releasing a few pre-releases and then +" keep that as a stable point. +function! Tex_Version() + return "Latex-Suite: version 1.8.23" +endfunction + +com! -nargs=0 TVersion echo Tex_Version() diff --git a/vim-latex/ftplugin/latex-suite/wizardfuncs.vim b/vim-latex/ftplugin/latex-suite/wizardfuncs.vim new file mode 100644 index 0000000..4a29069 --- /dev/null +++ b/vim-latex/ftplugin/latex-suite/wizardfuncs.vim @@ -0,0 +1,376 @@ +" File: wizardfuncs.vim +" Author: Mikolaj Machowski <mikmach@wp.pl> +" Description: +" +" Installation: +" History: pluginized by Srinath Avadhanula +"============================================================================= + +if exists('s:doneOnce') + finish +endif +let s:doneOnce = 1 + +let s:mapleader = exists('mapleader') ? mapleader : "\\" +" ============================================================================== +" Specialized functions for handling sections from command line +" ============================================================================== + +com! -nargs=? TSection call Tex_section(<f-args>) +com! -nargs=? TSectionAdvanced call Tex_section_adv(<f-args>) + +" Tex_VisSecAdv: handles visual selection for sections {{{ +function! Tex_VisSecAdv(section) + let shorttitle = input("Short title? ") + let toc = input("Include in table of contents [y]/n ? ") + let sstructure = "\\".a:section + if ( toc == "" || toc == "y" ) + let toc = "" + else + let toc = "*" + endif + if shorttitle != "" + let shorttitle = '['.shorttitle.']' + endif + exe "normal `>a}\<cr>\<esc>`<i".sstructure.toc.shorttitle."{" +endfunction + +" }}} +" Tex_InsSecAdv: section wizard in insert mode {{{ +function! Tex_InsSecAdv(structure) + let ttitle = input("Title? ") + let shorttitle = input("Short title? ") + let toc = input("Include in table of contents [y]/n ? ") + "Structure + let sstructure = "\\".a:structure + "TOC + if ( toc == "" || toc == "y" ) + let toc = "" + else + let toc = "*" + endif + "Shorttitle + if shorttitle != "" + let shorttitle = '['.shorttitle.']' + endif + "Title + let ttitle = '{'.ttitle.'}' + "Happy end? + return sstructure.toc.shorttitle.ttitle +endfunction + +" }}} +function! Tex_section(...) "{{{ + silent let pos = Tex_GetPos() + silent let last_section_value = s:Tex_section_detection() + if a:0 == 0 + silent let last_section_name = s:Tex_section_name(last_section_value) + silent call s:Tex_section_call(last_section_name) + elseif a:1 =~ "[+=\-]" + silent let sec_arg = a:1 + silent let curr_section_value = s:Tex_section_curr_rel_value(sec_arg, last_section_value) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + elseif a:1 == "?" + echo s:last_section_line + else + silent let curr_section_value = s:Tex_section_curr_value(a:1) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + endif + silent call Tex_SetPos(pos) +endfunction "}}} +function! Tex_section_adv(...) "{{{ + let pos = Tex_GetPos() + silent let last_section_value = s:Tex_section_detection() + if a:0 == 0 + silent let last_section_name = s:Tex_section_name(last_section_value) + let section = Tex_InsSecAdv(last_section_name) + elseif a:1 =~ "[+=\-]" + silent let sec_arg = a:1 + silent let curr_section_value = s:Tex_section_curr_rel_value(sec_arg, last_section_value) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + let section = Tex_InsSecAdv(curr_section_name) + else + silent let curr_section_value = s:Tex_section_curr_value(a:1) + silent let curr_section_name = s:Tex_section_name(curr_section_value) + silent call s:Tex_section_call(curr_section_name) + let section = Tex_InsSecAdv(curr_section_name) + endif + exe "normal i".section + call Tex_SetPos(pos) +endfunction "}}} +function! s:Tex_section_detection() "{{{ + let pos = Tex_GetPos() + let last_section1 = search("\\\\\subparagraph\\|\\\\paragraph\\|\\\\subsubsection\\|\\\\subsection\\|\\\\section\\|\\\\chapter\\|\\\part\)", "b") + call Tex_SetPos(pos) + let last_section2 = search("\\\\\part\\|\\\\chapter\\|\\\\section\\|\\\\subsection\\|\\\\subsubsection\\|\\\\paragraph\\|\\\subparagraph\)", "b") + if last_section1 > last_section2 + let last_section = last_section1 + else + let last_section = last_section2 + endif + if last_section != 0 + exe last_section + if getline(".") =~ "\\\\part" + let last_section_value = 0 + elseif getline(".") =~ "\\\\chapter" + let last_section_value = 1 + elseif getline(".") =~ "\\\\section" + let last_section_value = 2 + elseif getline(".") =~ "\\\\subsection" + let last_section_value = 3 + elseif getline(".") =~ "\\\\subsubsection" + let last_section_value = 4 + elseif getline(".") =~ "\\\\paragraph" + let last_section_value = 5 + elseif getline(".") =~ "\\\\subparagraph" + let last_section_value = 6 + endif + let s:last_section_line = getline(".") + else + let last_section_value = 0 + endif + call Tex_SetPos(pos) + return last_section_value +endfunction "}}} +function! s:Tex_section_curr_value(sec_arg) "{{{ + if a:sec_arg == "pa" || a:sec_arg == "0" || a:sec_arg == "part" + let curr_section_value = 0 + elseif a:sec_arg == "ch" || a:sec_arg == "1" || a:sec_arg == "chapter" + let curr_section_value = 1 + elseif a:sec_arg == "se" || a:sec_arg == "2" || a:sec_arg == "section" + let curr_section_value = 2 + elseif a:sec_arg == "ss" || a:sec_arg == "3" || a:sec_arg == "subsection" + let curr_section_value = 3 + elseif a:sec_arg == "s2" || a:sec_arg == "4" || a:sec_arg == "subsubsection" + let curr_section_value = 4 + elseif a:sec_arg == "pr" || a:sec_arg == "5" || a:sec_arg == "paragraph" + let curr_section_value = 5 + elseif a:sec_arg == "sp" || a:sec_arg == "6" || a:sec_arg == "subparagraph" + let curr_section_value = 6 + endif + return curr_section_value +endfunction "}}} +function! s:Tex_section_curr_rel_value(sec_arg, last_section_value) "{{{ + let last_section_value = a:last_section_value + if a:sec_arg == "+" || a:sec_arg == "+1" + let curr_section_value = last_section_value + 1 + elseif a:sec_arg == "++" || a:sec_arg == "+2" + let curr_section_value = last_section_value + 2 + elseif a:sec_arg == "-" || a:sec_arg == "-1" + let curr_section_value = last_section_value - 1 + elseif a:sec_arg == "--" || a:sec_arg == "-2" + let curr_section_value = last_section_value - 2 + elseif a:sec_arg == "=" + let curr_section_value = last_section_value + else + exe "let curr_section_value = last_section_value".a:sec_arg + endif + if curr_section_value < 0 + let curr_section_value = 0 + elseif curr_section_value > 6 + let curr_section_value = 6 + endif + return curr_section_value +endfunction "}}} +function! s:Tex_section_name(section_value) "{{{ + if a:section_value == 0 + let section_name = "part" + elseif a:section_value == 1 + let section_name = "chapter" + elseif a:section_value == 2 + let section_name = "section" + elseif a:section_value == 3 + let section_name = "subsection" + elseif a:section_value == 4 + let section_name = "subsubsection" + elseif a:section_value == 5 + let section_name = "paragraph" + elseif a:section_value == 6 + let section_name = "subparagraph" + endif + return section_name +endfunction "}}} +function! s:Tex_section_call(section_name) "{{{ + exe "normal! i\\".a:section_name."{<++>}<++>\<Esc>0\<C-j>" +" let ret_section = "\\".a:section_name."{<++>}<++>" +" exe "normal! i\<C-r>=IMAP_PutTextWithMovement(ret_section)\<CR>" +" normal f}i +endfunction "}}} + +" ============================================================================== +" Add looking help into latexhelp.txt +" ============================================================================== + +inoremap <silent> <Plug>Tex_Help <C-o>:call <SID>TexHelp()<CR> +nnoremap <silent> <Plug>Tex_Help :call <SID>TexHelp()<CR> +command! -nargs=0 THelp call <SID>TexHelp() +call Tex_MakeMap('<F1>', '<Plug>Tex_Help', 'i', '') +call Tex_MakeMap('<F1>', '<Plug>Tex_Help', 'n', '') + +" TexHelp: Cursor being on LaTeX item check if exists help tag about it " {{{ +function! s:TexHelp() + let syntax_item = synIDattr(synID(line('.'),col('.')-1,0),"name") + if syntax_item =~ '^tex' + setlocal isk+=\ + let curword = expand('<cword>') + setlocal isk-=\ + let v:errmsg = '' + if curword =~ "^\\" || syntax_item == 'texSectionName' + exe 'silent! help '.curword + if v:errmsg =~ '^E149:' + echohl ErrorMsg + exe "echomsg 'Sorry, no help for LaTeX: ".curword."'" + echohl None + let v:errmsg = '' + endif + else + help + endif + else + help + endif +endfunction " }}} + +" ============================================================================== +" Tables of shortcuts +" ============================================================================== +" +command! -nargs=? Tshortcuts call Tex_shortcuts(<f-args>)<CR> + +" Tex_shortcuts: Show shortcuts in terminal after : command {{{ +function! Tex_shortcuts(...) + if a:0 == 0 + let shorts = input(" Allowed arguments are:" + \."\n g General" + \."\n e Environments" + \."\n f Fonts" + \."\n s Sections" + \."\n m Math" + \."\n a All" + \."\n Enter your choice (<Enter> quits) : ") + call Tex_shortcuts(shorts) + elseif a:1 == 'g' + echo g:generalshortcuts + elseif a:1 == 'e' + echo g:environmentshortcuts + elseif a:1 == 'f' + echo g:fontshortcuts + elseif a:1 == 's' + echo g:sectionshortcuts + elseif a:1 == 'm' + echo g:mathshortcuts + elseif a:1 == 'a' + echo g:generalshortcuts + echo g:environmentshortcuts + echo g:fontshortcuts + echo g:sectionshortcuts + echo g:mathshortcuts + endif + +endfunction +" }}} + +" General shortcuts {{{ +let g:generalshortcuts = '' +\."\n General shortcuts" +\."\n <mapleader> is a value of <Leader>" +\."\n ".s:mapleader.'ll compile whole document' +\."\n ".s:mapleader.'lv view compiled document' +\."\n ".s:mapleader.'ls forward searching (if possible)' +\."\n ".s:mapleader.'rf refresh folds' +" }}} +" Environment shortcuts {{{ +let g:environmentshortcuts = '' +\."\n Environment shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader2" +\."\n I v&V I v&V" +\."\n ELI ".g:Tex_Leader2."li list EQN ".g:Tex_Leader2."qn quotation" +\."\n EDE ".g:Tex_Leader2."de description ESP ".g:Tex_Leader2."sb sloppypar" +\."\n EEN ".g:Tex_Leader2."en enumerate ETI ".g:Tex_Leader2."ti theindex" +\."\n EIT ".g:Tex_Leader2."it itemize ETP ".g:Tex_Leader2."tp titlepage" +\."\n ETI ".g:Tex_Leader2."ti theindex EVM ".g:Tex_Leader2."vm verbatim" +\."\n ETL ".g:Tex_Leader2."tl trivlist EVE ".g:Tex_Leader2."ve verse" +\."\n ETE ".g:Tex_Leader2."te table ETB ".g:Tex_Leader2."tb thebibliography" +\."\n ETG ".g:Tex_Leader2."tg tabbing ENO ".g:Tex_Leader2."no note" +\."\n ETR ".g:Tex_Leader2."tr tabular EOV ".g:Tex_Leader2."ov overlay" +\."\n EAR ".g:Tex_Leader2."ar array ESL ".g:Tex_Leader2."sl slide" +\."\n EDM ".g:Tex_Leader2."dm displaymath EAB ".g:Tex_Leader2."ab abstract" +\."\n EEA ".g:Tex_Leader2."ea eqnarray EAP ".g:Tex_Leader2."ap appendix" +\."\n EEQ ".g:Tex_Leader2."eq equation ECE ".g:Tex_Leader2."ce center" +\."\n EDO ".g:Tex_Leader2."do document EFI ".g:Tex_Leader2."fi figure" +\."\n EFC ".g:Tex_Leader2."fc filecontents ELR ".g:Tex_Leader2."lr lrbox" +\."\n EFL ".g:Tex_Leader2."fl flushleft EMP ".g:Tex_Leader2."mp minipage" +\."\n EFR ".g:Tex_Leader2."fr flushright EPI ".g:Tex_Leader2."pi picture" +\."\n EMA ".g:Tex_Leader2."ma math EQE ".g:Tex_Leader2."qe quote" +" }}} +" Font shortcuts {{{ +let g:fontshortcuts = '' +\."\n Font shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader" +\."\n Shortcuts Effects" +\."\n I v&V I&v V" +\."\n FBF ".g:Tex_Leader."bf \\textbf{} {\\bfseries }" +\."\n FMD ".g:Tex_Leader."md \\textmd{} {\\mdseries }" +\."\n" +\."\n FTT ".g:Tex_Leader."tt \\texttt{} {\\ttfamily }" +\."\n FSF ".g:Tex_Leader."sf \\textsf{} {\\sffamily }" +\."\n FRM ".g:Tex_Leader."rm \\textrm{} {\\rmfamily }" +\."\n" +\."\n FUP ".g:Tex_Leader."up \\textup{} {\\upshape }" +\."\n FSL ".g:Tex_Leader."sl \\textsl{} {\\slshape }" +\."\n FSC ".g:Tex_Leader."sc \\textsc{} {\\scshape }" +\."\n FIT ".g:Tex_Leader."it \\textit{} {\\itshape }" +" }}} +" Section shortcuts {{{ +let g:sectionshortcuts = '' +\."\n Section shortcuts" +\."\n <mapleader> is a value of g:Tex_Leader2" +\."\n I v&V" +\."\n SPA ".g:Tex_Leader2."pa part" +\."\n SCH ".g:Tex_Leader2."ch chapter" +\."\n SSE ".g:Tex_Leader2."se section" +\."\n SSS ".g:Tex_Leader2."ss subsection" +\."\n SS2 ".g:Tex_Leader2."s2 subsubsection" +\."\n SPG ".g:Tex_Leader2."pg paragraph" +\."\n SSP ".g:Tex_Leader2."sp subparagraph" +" }}} +" Math shortcuts {{{ +let g:mathshortcuts = '' +\."\n Math shortcuts - Insert mode" +\."\n `a \\alpha `b \\beta" +\."\n `g \\gamma `d \\delta" +\."\n `e \\varepsilon `z \\zeta" +\."\n `h \\eta `q \\theta" +\."\n `i \\iota `k \\kappa" +\."\n `l \\lambda `m \\mu" +\."\n `n \\nu `x \\xi" +\."\n `p \\pi `r \\rho" +\."\n `s \\sigma `v \\varsigma" +\."\n `t \\tau `u \\upsilon" +\."\n `f \\varphi `c \\chi" +\."\n `y \\psi `w \\omega" +\."\n `A \\Alpha `B \\Beta" +\."\n `G \\Gamma `D \\Delta" +\."\n `E \\Epsilon `Z \\mathrm{Z}" +\."\n `H \\Eta `K \\Kappa" +\."\n `L \\Lambda `M \\Mu" +\."\n `N \\Nu `X \\Xi" +\."\n `P \\Pi `R \\Rho" +\."\n `S \\Sigma `T \\Tau" +\."\n `U \\Upsilon `C \\Chi" +\."\n `Y \\Psi `W \\Omega" +\."\n `( \\subset `) \\Subset" +\."\n `= \\equiv =~ \\approx" +\."\n `- \\bigcap `+ \\bigcup" +\."\n `. \\cdot `* \\times" +\."\n `\\ \\setminus `@ \\circ" +\."\n `& \\wedge `, \\nonumber" +\."\n `8 \\infty `_ \\bar{}" +\."\n `: \\ddot{} `; \\dot{}" +\."\n `^ \\hat{} `~ \\tilde{}" +\."\n `6 \\partial" +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/vim-latex/ftplugin/tex_latexSuite.vim b/vim-latex/ftplugin/tex_latexSuite.vim new file mode 100644 index 0000000..7ad5acc --- /dev/null +++ b/vim-latex/ftplugin/tex_latexSuite.vim @@ -0,0 +1,13 @@ +" LaTeX filetype +" Language: LaTeX (ft=tex) +" Maintainer: Srinath Avadhanula +" Email: srinath@fastmail.fm + +if !exists('s:initLatexSuite') + let s:initLatexSuite = 1 + exec 'so '.fnameescape(expand('<sfile>:p:h').'/latex-suite/main.vim') + + silent! do LatexSuite User LatexSuiteInitPost +endif + +silent! do LatexSuite User LatexSuiteFileType diff --git a/vim-latex/indent/tex.vim b/vim-latex/indent/tex.vim new file mode 100644 index 0000000..76e260b --- /dev/null +++ b/vim-latex/indent/tex.vim @@ -0,0 +1,226 @@ +" Vim indent file +" Language: LaTeX +" Maintainer: Johannes Tanzler <johannes.tanzler@gmail.com> +" Version: 0.5 +" Created: Sat, 16 Feb 2002 16:50:19 +0100 +" Last Change: Mar, 27 Jun 2011 11:46:35 +0200 +" Last Update: 18th feb 2002, by LH : +" (*) better support for the option +" (*) use some regex instead of several '||'. +" Oct 9th, 2003, by JT: +" (*) don't change indentation of lines starting with '%' +" 2005/06/15, Moshe Kaminsky <kaminsky@math.huji.ac.il> +" (*) New variables: +" g:tex_items, g:tex_itemize_env, g:tex_noindent_env +" 2011/3/6, by Zhou Yi Chao <broken.zhou@gmail.com> +" (*) Don't change indentation of lines starting with '%' +" I don't see any code with '%' and it doesn't work properly +" so I add some code. +" (*) New features: Add smartindent-like indent +" for "{}" and "[]". +" (*) New variables: g:tex_indent_brace +" +" Options: {{{ +" +" To set the following options (ok, currently it's just one), add a line like +" let g:tex_indent_items = 1 +" to your ~/.vimrc. +" +" * g:tex_indent_brace +" +" If this variable is unset or non-zero, it will use smartindent-like style +" for "{}" and "[]" +" +" * g:tex_indent_items +" +" If this variable is set, item-environments are indented like Emacs does +" it, i.e., continuation lines are indented with a shiftwidth. +" +" NOTE: I've already set the variable below; delete the corresponding line +" if you don't like this behaviour. +" +" Per default, it is unset. +" +" set unset +" ---------------------------------------------------------------- +" \begin{itemize} \begin{itemize} +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \item blablabla \item blablabla +" bla bla bla bla bla bla +" \end{itemize} \end{itemize} +" +" +" * g:tex_items +" +" A list of tokens to be considered as commands for the beginning of an item +" command. The tokens should be separated with '\|'. The initial '\' should +" be escaped. The default is '\\bibitem\|\\item'. +" +" * g:tex_itemize_env +" +" A list of environment names, separated with '\|', where the items (item +" commands matching g:tex_items) may appear. The default is +" 'itemize\|description\|enumerate\|thebibliography'. +" +" * g:tex_noindent_env +" +" A list of environment names. separated with '\|', where no indentation is +" required. The default is 'document\|verbatim\|comment\|lstlisting'. +" +" }}} +" +" License: {{{ +" Copyright (c) 2002-2011 Johannes Tanzler <johannes.tanzler@gmail.com> + +" Permission is hereby granted, free of charge, to any person obtaining +" a copy of this software and associated documentation files (the +" "Software"), to deal in the Software without restriction, including +" without limitation the rights to use, copy, modify, merge, publish, +" distribute, sublicense, and/or sell copies of the Software, and to +" permit persons to whom the Software is furnished to do so, subject to +" the following conditions: +" +" The above copyright notice and this permission notice shall be included +" in all copies or substantial portions of the Software. +" +" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +" }}} + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" Delete the next line to avoid the special indention of items +if !exists("g:tex_indent_items") + let g:tex_indent_items = 1 +endif +if !exists("g:tex_indent_brace") + let g:tex_indent_brace = 1 +endif +if g:tex_indent_items + if !exists("g:tex_itemize_env") + let g:tex_itemize_env = 'itemize\|description\|enumerate\|thebibliography' + endif + if !exists('g:tex_items') + let g:tex_items = '\\bibitem\|\\item' + endif +else + let g:tex_items = '' +endif + +if !exists("g:tex_noindent_env") + let g:tex_noindent_env = 'document\|verbatim\|comment\|lstlisting' +endif + +setlocal autoindent +setlocal nosmartindent +setlocal indentexpr=GetTeXIndent() +exec 'setlocal indentkeys+=},]' . substitute(g:tex_items, '^\|\(\\|\)', ',=', 'g') +let g:tex_items = '^\s*' . g:tex_items + + +" Only define the function once +if exists("*GetTeXIndent") | finish +endif + + + +function GetTeXIndent() + + " Find a non-blank line above the current line. + let lnum = prevnonblank(v:lnum - 1) + + " New code for comments: Comments is not what we need. + while lnum != 0 + if getline(lnum) !~ '^\s*%' + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + + " At the start of the file use zero indent. + if lnum == 0 | return 0 + endif + + let ind = indent(lnum) + let line = getline(lnum) " last line + let cline = getline(v:lnum) " current line + + " New code for comment: retain the indent of current line + if cline =~ '^\s*%' + return indent(v:lnum) + endif + + " Add a 'shiftwidth' after beginning of environments. + " Don't add it for \begin{document} and \begin{verbatim} + ""if line =~ '^\s*\\begin{\(.*\)}' && line !~ 'verbatim' + " LH modification : \begin does not always start a line + if line =~ '\\begin{.*}' && line !~ g:tex_noindent_env + + let ind = ind + &sw + + if g:tex_indent_items + " Add another sw for item-environments + if line =~ g:tex_itemize_env + let ind = ind + &sw + endif + endif + endif + + + " Subtract a 'shiftwidth' when an environment ends + if cline =~ '^\s*\\end' && cline !~ g:tex_noindent_env + + if g:tex_indent_items + " Remove another sw for item-environments + if cline =~ g:tex_itemize_env + let ind = ind - &sw + endif + endif + + let ind = ind - &sw + endif + + if g:tex_indent_brace + " Add a 'shiftwidth' after a "{" or "[" while there are not "}" and "]" + " after them. \m for magic + if line =~ '\m\(\(\[[^\]]*\)\|\({[^}]*\)\)$' + let ind = ind + &sw + endif + " Remove a 'shiftwidth' after a "}" or "]" while there are not "{" and "[" + " before them. \m for magic + if cline =~ '\m^\(\([^\[]*\]\)\|\([^{]*}\)\)' + let ind = ind - &sw + endif + endif + + + " Special treatment for 'item' + " ---------------------------- + + if g:tex_indent_items + + " '\item' or '\bibitem' itself: + if cline =~ g:tex_items + let ind = ind - &sw + endif + + " lines following to '\item' are intented once again: + if line =~ g:tex_items + let ind = ind + &sw + endif + + endif + + return ind +endfunction + +" vim: set sw=4 textwidth=78: diff --git a/vim-latex/latextags b/vim-latex/latextags new file mode 100755 index 0000000..01b6596 --- /dev/null +++ b/vim-latex/latextags @@ -0,0 +1,11 @@ +#!/usr/bin/perl + +foreach $fname (@ARGV) { + $tags = `fgrep \\label $fname`; + @tagsList = split('\n', $tags); + foreach $tag (@tagsList) { + $tag =~ /.*\\label{([^}]*)}/; + $tagName = $1; + print "$tagName\t$fname\t/label{$tagName}/\n"; + } +} diff --git a/vim-latex/ltags b/vim-latex/ltags new file mode 100755 index 0000000..bec7c56 --- /dev/null +++ b/vim-latex/ltags @@ -0,0 +1,78 @@ +#!/usr/bin/perl +# Author: Dimitri Antoniou <dimitri@risc2.aecom.yu.edu> +# usage: ltags filename +# handles: \label and \cite{ } with one or more arguments +# fails if arguments of cite spread over more than one line +# also searches in files that are \include or \input in the main file + +# get main LaTeX source file from command line: +$mainfile = shift; + +# get names of included files and store them in an array +open MAIN, $mainfile or die "$!" ; +@mainfile=<MAIN>; +@allsrcfiles = map{ /^\\(?:input|include){(.*?)}/ } @mainfile; +unshift @allsrcfiles, $mainfile; + +# loop over all source files +for $srcfile (@allsrcfiles) { + # if \input{fname} append .tex to fname + unless ( $srcfile =~ m/\.tex/ ) { $srcfile = $srcfile . "\.tex" } + open SRC, $srcfile or die "$!" ; + # store contents of source file in array @texfile + @texfile=<SRC>; + + # store lines with \label and \cite (or \citeonline) in arrays + @labelList = grep{ /\\label{/ } @texfile; + @citeList = grep{ /\\(cite|citeonline){/ } @texfile; + + # see if we use an external database; if yes, store its name in $bibfile + ($dbase) = grep{ /^\\bibliography{/ } @texfile; + if ($dbase) { + $dbase =~ m/\\bibliography{(.*?)}/; + $bibfile = $1; + } + + # write \bibitem in tags file + @mrefs=(); + @refs=(); + @multirefs=(); + foreach (@citeList) { + while ( m/\\(?:cite|citeonline){(.*?)}/g ) { + $refs = $1; + # if \cite has more than one argument, split them: + if ($refs =~ /,/) { + @mrefs = split /,/, $refs; + # there might be more than one \cite in a line: + push (@multirefs, @mrefs); + } + else { + @refs = ($refs); + push (@multirefs, @refs); + } + } + # in BibTeX, format is @ARTICLE{Name, }; in source file, \bibitem{Name} + for $ref (@multirefs) { + if ( $dbase ) { + push @unsorttag, "$ref\t$bibfile\t/{$ref,/\n" + } + else { + push @unsorttag, "$ref\t$srcfile\t/bibitem{$ref}/\n" + } + } + } + + # write \label in tag file + foreach (@labelList) { + m/\\label{(.*?)}/; + push @unsorttag, "$1\t$srcfile\t/label{$1}/\n"; + } +} + +# sort tag file; then, eliminate duplicates +@sortedtag = sort @unsorttag; +%seen = (); +@uniqtag = grep { ! $seen{$_} ++ } @sortedtag; + +open(TAGS, "> tags"); +print TAGS @uniqtag; diff --git a/vim-latex/plugin/SyntaxFolds.vim b/vim-latex/plugin/SyntaxFolds.vim new file mode 100644 index 0000000..27c622c --- /dev/null +++ b/vim-latex/plugin/SyntaxFolds.vim @@ -0,0 +1,323 @@ +" ============================================================================== +" File: syntaxFolds.vim +" Author: Srinath Avadhanula +" ( srinath@fastmail.fm ) +" Last Change: Sun Oct 27 01:00 AM 2002 PST +" Description: Emulation of the syntax folding capability of vim using manual +" folding +" +" This script provides an emulation of the syntax folding of vim using manual +" folding. Just as in syntax folding, the folds are defined by regions. Each +" region is specified by a call to FoldRegions() which accepts 4 parameters: +" +" call FoldRegions(startpat, endpat, startoff, endoff) +" +" startpat: a line matching this pattern defines the beginning of a fold. +" endpat : a line matching this pattern defines the end of a fold. +" startoff: this is the offset from the starting line at which folding will +" actually start +" endoff : like startoff, but gives the offset of the actual fold end from +" the line satisfying endpat. +" startoff and endoff are necessary when the folding region does +" not have a specific end pattern corresponding to a start +" pattern. for example in latex, +" \begin{section} +" defines the beginning of a section, but its not necessary to +" have a corresponding +" \end{section} +" the section is assumed to end 1 line _before_ another section +" starts. +" startskip: a pattern which defines the beginning of a "skipped" region. +" +" For example, suppose we define a \itemize fold as follows: +" startpat = '^\s*\\item', +" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +" startoff = 0, +" endoff = -1 +" +" This defines a fold which starts with a line beginning with an +" \item and ending one line before a line beginning with an +" \item or \end{enumerate} etc. +" +" Then, as long as \item's are not nested things are fine. +" However, once items begin to nest, the fold started by one +" \item can end because of an \item in an \itemize +" environment within this \item. i.e, the following can happen: +" +" \begin{itemize} +" \item Some text <------- fold will start here +" This item will contain a nested item +" \begin{itemize} <----- fold will end here because next line contains \item... +" \item Hello +" \end{itemize} <----- ... instead of here. +" \item Next item of the parent itemize +" \end{itemize} +" +" Therefore, in order to completely define a folding item which +" allows nesting, we need to also define a "skip" pattern. +" startskip and end skip do that. +" Leave '' when there is no nesting. +" endskip: the pattern which defines the end of the "skip" pattern for +" nested folds. +" +" Example: +" 1. A syntax fold region for a latex section is +" startpat = "\\section{" +" endpat = "\\section{" +" startoff = 0 +" endoff = -1 +" startskip = '' +" endskip = '' +" Note that the start and end patterns are thus the same and endoff has a +" negative value to capture the effect of a section ending one line before +" the next starts. +" 2. A syntax fold region for the \itemize environment is: +" startpat = '^\s*\\item', +" endpat = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}', +" startoff = 0, +" endoff = -1, +" startskip = '^\s*\\begin{\(enumerate\|itemize\|description\)}', +" endskip = '^\s*\\end{\(enumerate\|itemize\|description\)}' +" Note the use of startskip and endskip to allow nesting. +" +" +" Each time a call is made to FoldRegions(), all the regions (which might be +" disjoint, but not nested) are folded up. +" Nested folds can be created by successive calls to FoldRegions(). The first +" call defines the region which is deepest in the folding. See MakeTexFolds() +" for an idea of how this works for latex files. + +" Function: AddSyntaxFoldItem (start, end, startoff, endoff [, skipStart, skipEnd]) {{{ +function! AddSyntaxFoldItem(start, end, startoff, endoff, ...) + if a:0 > 0 + let skipStart = a:1 + let skipEnd = a:2 + else + let skipStart = '' + let skipEnd = '' + end + if !exists('b:numFoldItems') + let b:numFoldItems = 0 + end + let b:numFoldItems = b:numFoldItems + 1 + + exe 'let b:startPat_'.b:numFoldItems.' = a:start' + exe 'let b:endPat_'.b:numFoldItems.' = a:end' + exe 'let b:startOff_'.b:numFoldItems.' = a:startoff' + exe 'let b:endOff_'.b:numFoldItems.' = a:endoff' + exe 'let b:skipStartPat_'.b:numFoldItems.' = skipStart' + exe 'let b:skipEndPat_'.b:numFoldItems.' = skipEnd' +endfunction + + +" }}} +" Function: MakeSyntaxFolds (force) {{{ +" Description: This function calls FoldRegions() several times with the +" parameters specifying various regions resulting in a nested fold +" structure for the file. +function! MakeSyntaxFolds(force, ...) + if exists('b:doneFolding') && a:force == 0 + return + end + + let skipEndPattern = '' + if a:0 > 0 + let line1 = a:1 + let skipEndPattern = '\|'.a:2 + else + let line1 = 1 + let r = line('.') + let c = virtcol('.') + + setlocal fdm=manual + normal! zE + end + if !exists('b:numFoldItems') + b:numFoldItems = 1000000 + end + + let i = 1 + + let maxline = line('.') + + while exists('b:startPat_'.i) && i <= b:numFoldItems + exe 'let startPat = b:startPat_'.i + exe 'let endPat = b:endPat_'.i + exe 'let startOff = b:startOff_'.i + exe 'let endOff = b:endOff_'.i + + let skipStart = '' + let skipEnd = '' + if exists('b:skipStartPat_'.i) + exe 'let skipStart = b:skipStartPat_'.i + exe 'let skipEnd = b:skipEndPat_'.i + end + exe line1 + let lastLoc = line1 + + if skipStart != '' + call InitStack('BeginSkipArray') + call FoldRegionsWithSkip(startPat, endPat, startOff, endOff, skipStart, skipEnd, 1, line('$')) + " call PrintError('done folding ['.startPat.']') + else + call FoldRegionsWithNoSkip(startPat, endPat, startOff, endOff, 1, line('$'), '') + end + + let i = i + 1 + endwhile + + exe maxline + + if a:0 == 0 + exe r + exe "normal! ".c."|" + if foldlevel(r) > 1 + exe "normal! ".(foldlevel(r) - 1)."zo" + end + let b:doneFolding = 0 + end +endfunction + + +" }}} +" FoldRegionsWithSkip: folding things such as \item's which can be nested. {{{ +function! FoldRegionsWithSkip(startpat, endpat, startoff, endoff, startskip, endskip, line1, line2) + exe a:line1 + " count the regions which have been skipped as we go along. do not want to + " create a fold which with a beginning or end line in one of the skipped + " regions. + let skippedRegions = '' + + " start searching for either the starting pattern or the end pattern. + while search(a:startskip.'\|'.a:endskip, 'W') + + if getline('.') =~ a:endskip + + let lastBegin = Pop('BeginSkipArray') + " call PrintError('popping '.lastBegin.' from stack and folding till '.line('.')) + call FoldRegionsWithNoSkip(a:startpat, a:endpat, a:startoff, a:endoff, lastBegin, line('.'), skippedRegions) + let skippedRegions = skippedRegions.lastBegin.','.line('.').'|' + + + " if this is the beginning of a skip region, then, push this line as + " the beginning of a skipped region. + elseif getline('.') =~ a:startskip + + " call PrintError('pushing '.line('.').' ['.getline('.').'] into stack') + call Push('BeginSkipArray', line('.')) + + end + endwhile + + " call PrintError('with skip starting at '.a:line1.' returning at line# '.line('.')) +endfunction + +" }}} +" FoldRegionsWithNoSkip: folding things such as \sections which do not nest. {{{ +function! FoldRegionsWithNoSkip(startpat, endpat, startoff, endoff, line1, line2, skippedRegions) + exe a:line1 + + " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') + let lineBegin = s:MySearch(a:startpat, 'in') + " call PrintError('... and finding it at '.lineBegin) + + while lineBegin <= a:line2 + if IsInSkippedRegion(lineBegin, a:skippedRegions) + let lineBegin = s:MySearch(a:startpat, 'out') + " call PrintError(lineBegin.' is being skipped') + continue + end + let lineEnd = s:MySearch(a:endpat, 'out') + while IsInSkippedRegion(lineEnd, a:skippedRegions) && lineEnd <= a:line2 + let lineEnd = s:MySearch(a:endpat, 'out') + endwhile + if lineEnd > a:line2 + exe (lineBegin + a:startoff).','.a:line2.' fold' + break + else + " call PrintError ('for ['.a:startpat.'] '.(lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold') + exe (lineBegin + a:startoff).','.(lineEnd + a:endoff).' fold' + end + + " call PrintError('line1 = '.a:line1.', searching from '.line('.').'... for ['.a:startpat.'') + let lineBegin = s:MySearch(a:startpat, 'in') + " call PrintError('... and finding it at '.lineBegin) + endwhile + + exe a:line2 + return +endfunction + +" }}} +" InitStack: initialize a stack {{{ +function! InitStack(name) + exe 'let s:'.a:name.'_numElems = 0' +endfunction +" }}} +" Push: push element into stack {{{ +function! Push(name, elem) + exe 'let numElems = s:'.a:name.'_numElems' + let numElems = numElems + 1 + exe 'let s:'.a:name.'_Element_'.numElems.' = a:elem' + exe 'let s:'.a:name.'_numElems = numElems' +endfunction +" }}} +" Pop: pops element off stack {{{ +function! Pop(name) + exe 'let numElems = s:'.a:name.'_numElems' + if numElems == 0 + return '' + else + exe 'let ret = s:'.a:name.'_Element_'.numElems + let numElems = numElems - 1 + exe 'let s:'.a:name.'_numElems = numElems' + return ret + end +endfunction +" }}} +" MySearch: just like search(), but returns large number on failure {{{ +function! <SID>MySearch(pat, opt) + if a:opt == 'in' + if getline('.') =~ a:pat + let ret = line('.') + else + let ret = search(a:pat, 'W') + end + else + normal! $ + let ret = search(a:pat, 'W') + end + + if ret == 0 + let ret = line('$') + 1 + end + return ret +endfunction +" }}} +" Function: IsInSkippedRegion (lnum, regions) {{{ +" Description: finds whether a given line number is within one of the regions +" skipped. +function! IsInSkippedRegion(lnum, regions) + let i = 1 + let subset = s:Strntok(a:regions, '|', i) + while subset != '' + let n1 = s:Strntok(subset, ',', 1) + let n2 = s:Strntok(subset, ',', 2) + if a:lnum >= n1 && a:lnum <= n2 + return 1 + end + + let subset = s:Strntok(a:regions, '|', i) + let i = i + 1 + endwhile + + return 0 +endfunction " }}} +" Function: Strntok (string, tok, n) {{{ +" extract the n^th token from s seperated by tok. +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun " }}} + +" vim600:fdm=marker diff --git a/vim-latex/plugin/filebrowser.vim b/vim-latex/plugin/filebrowser.vim new file mode 100644 index 0000000..4be8c46 --- /dev/null +++ b/vim-latex/plugin/filebrowser.vim @@ -0,0 +1,250 @@ +" filebrowser.vim: utility file for vim 6.2+ +" +" Copyright: Srinath Avadhanula <srinath AT fastmail DOT fm> +" Parts of this file are taken from explorer.vim which is a plugin file +" distributed with vim under the Vim charityware license. +" License: distributed under the Vim charityware license. +" +" Settings: +" FB_CallBackFunction: the function name which gets called when the user +" presses <cr> on a file-name in the file browser. +" FB_AllowRegexp: A filename has to match this regexp to be displayed. +" FB_RejectRegexp: If a filename matches this regexp, then its not displayed. +" (Both these regexps are '' by default which means no filtering is +" done). + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +"====================================================================== +" Globally visible functions (API) +"====================================================================== +" FB_OpenFileBrowser: opens a new buffer and displays the file list {{{ +" Description: +function! FB_OpenFileBrowser(dir) + if !isdirectory(a:dir) + return + endif + if exists('s:FB_BufferNumber') + if bufwinnr(s:FB_BufferNumber) != -1 + execute bufwinnr(s:FB_BufferNumber).' wincmd w' + return + endif + execute 'aboveleft split #'.s:FB_BufferNumber + else + aboveleft split __Choose_File__ + let s:FB_BufferNumber = bufnr('%') + endif + call FB_DisplayFiles(a:dir) +endfunction " }}} +" FB_DisplayFiles: displays the files in a given directory {{{ +" Description: +" Call this function only when the cursor is in a temporary buffer +function! FB_DisplayFiles(dir) + if !isdirectory(a:dir) + return + endif + call s:FB_SetSilentSettings() + " make this a "scratch" buffer + call s:FB_SetScratchSettings() + + let allowRegexp = s:FB_GetVar('FB_AllowRegexp', '') + let rejectRegexp = s:FB_GetVar('FB_RejectRegexp', '') + + " change to the directory to make processing simpler. + execute "lcd ".a:dir + " delete everything in the buffer. + " IMPORTANT: we need to be in a scratch buffer + 0,$ d_ + + let allFilenames = glob('*') + let dispFiles = "" + let subDirs = "../\n" + + let allFilenames = allFilenames."\n" + let start = 0 + while 1 + let next = stridx(allFilenames, "\n", start) + let filename = strpart(allFilenames, start, next-start) + if filename == "" + break + endif + + if isdirectory(filename) + let subDirs = subDirs.filename."/\n" + else + if allowRegexp != '' && filename !~ allowRegexp + elseif rejectRegexp != '' && filename =~ rejectRegexp + else + let dispFiles = dispFiles.filename."\n" + endif + endif + + let start = next + 1 + endwhile + + 0put!=dispFiles + 0put!=subDirs + " delte the last empty line resulting from the put + $ d_ + + call s:FB_SetHighlighting() + call s:FB_DisplayHelp() + call s:FB_SetMaps() + + " goto the first file/directory + 0 + call search('^"=', 'w') + normal! j:<bs> + + set nomodified nomodifiable + + call s:FB_ResetSilentSettings() +endfunction " }}} +" FB_SetVar: sets script local variables from outside this script {{{ +" Description: +function! FB_SetVar(varname, value) + let s:{a:varname} = a:value +endfunction " }}} + +" ============================================================================== +" Script local functions below this +" ============================================================================== +" FB_SetHighlighting: sets syntax highlighting for the buffer {{{ +" Description: +" Origin: from explorer.vim in vim +function! <SID>FB_SetHighlighting() + " Set up syntax highlighting + " Something wrong with the evaluation of the conditional though... + if has("syntax") && exists("g:syntax_on") && !has("syntax_items") + syn match browseSynopsis "^\"[ -].*" + syn match browseDirectory "[^\"].*/ " + syn match browseDirectory "[^\"].*/$" + syn match browseCurDir "^\"= .*$" + syn match browseSortBy "^\" Sorted by .*$" contains=browseSuffixInfo + syn match browseSuffixInfo "(.*)$" contained + syn match browseFilter "^\" Not Showing:.*$" + syn match browseFiletime "«\d\+$" + + "hi def link browseSynopsis PreProc + hi def link browseSynopsis Special + hi def link browseDirectory Directory + hi def link browseCurDir Statement + hi def link browseSortBy String + hi def link browseSuffixInfo Type + hi def link browseFilter String + hi def link browseFiletime Ignore + hi def link browseSuffixes Type + endif +endfunction " }}} +" FB_SetMaps: sets buffer local maps {{{ +" Description: +function! <SID>FB_SetMaps() + nnoremap <buffer> <silent> q :bdelete<cr> + nnoremap <buffer> <silent> C :call FB_DisplayFiles(getcwd())<CR> + nnoremap <buffer> <silent> <esc> :bdelete<cr> + nnoremap <buffer> <silent> <CR> :call <SID>FB_EditEntry()<CR> + nnoremap <buffer> <silent> ? :call <SID>FB_ToggleHelp()<CR> + + " lock the user in this window + nnoremap <buffer> <C-w> <nop> +endfunction " }}} +" FB_SetSilentSettings: some settings which make things silent {{{ +" Description: +" Origin: from explorer.vim distributed with vim. +function! <SID>FB_SetSilentSettings() + let s:save_report=&report + let s:save_showcmd = &sc + set report=10000 noshowcmd +endfunction +" FB_ResetSilentSettings: reset settings set by FB_SetSilentSettings +" Description: +function! <SID>FB_ResetSilentSettings() + let &report=s:save_report + let &showcmd = s:save_showcmd +endfunction " }}} +" FB_SetScratchSettings: makes the present buffer a scratch buffer {{{ +" Description: +function! <SID>FB_SetScratchSettings() + " Turn off the swapfile, set the buffer type so that it won't get + " written, and so that it will get deleted when it gets hidden. + setlocal noreadonly modifiable + setlocal noswapfile + setlocal buftype=nowrite + setlocal bufhidden=delete + " Don't wrap around long lines + setlocal nowrap +endfunction + +" }}} +" FB_ToggleHelp: toggles verbosity of help {{{ +" Description: +function! <SID>FB_ToggleHelp() + let s:FB_VerboseHelp = 1 - s:FB_GetVar('FB_VerboseHelp', 0) + + call FB_DisplayFiles('.') +endfunction " }}} +" FB_DisplayHelp: displays a helpful header {{{ +" Description: +function! <SID>FB_DisplayHelp() + let verboseHelp = s:FB_GetVar('FB_VerboseHelp', 0) + if verboseHelp + let txt = + \ "\" <cr>: on file, choose the file and quit\n" + \ ."\" on dir, enter directory\n" + \ ."\" q/<esc>: quit without choosing\n" + \ ."\" C: change directory to getcwd()\n" + \ ."\" ?: toggle help verbosity\n" + \ ."\"= ".getcwd() + else + let txt = "\" ?: toggle help verbosity\n" + \ ."\"= ".getcwd() + endif + 0put!=txt +endfunction " }}} +" FB_EditEntry: handles the user pressing <enter> on a line {{{ +" Description: +function! <SID>FB_EditEntry() + let line = getline('.') + + if isdirectory(line) + call FB_DisplayFiles(line) + endif + + " If the user has a call back function defined on choosing a file, handle + " it. + let cbf = s:FB_GetVar('FB_CallBackFunction', '') + if cbf != '' && line !~ '^" ' && filereadable(line) + let fname = fnamemodify(line, ':p') + bdelete + + let arguments = s:FB_GetVar('FB_CallBackFunctionArgs', '') + if arguments != '' + let arguments = ','.arguments + endif + call Tex_Debug('arguments = '.arguments, 'fb') + call Tex_Debug("call ".cbf."('".fname."'".arguments.')', 'fb') + exec "call ".cbf."('".fname."'".arguments.')' + endif +endfunction " }}} +" FB_GetVar: gets the most local value of a variable {{{ +function! <SID>FB_GetVar(name, default) + if exists('s:'.a:name) + return s:{a:name} + elseif exists('w:'.a:name) + return w:{a:name} + elseif exists('b:'.a:name) + return b:{a:name} + elseif exists('g:'.a:name) + return g:{a:name} + else + return a:default + endif +endfunction + +" }}} + +let &cpo = s:save_cpo + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4:nowrap diff --git a/vim-latex/plugin/imaps.vim b/vim-latex/plugin/imaps.vim new file mode 100644 index 0000000..28023be --- /dev/null +++ b/vim-latex/plugin/imaps.vim @@ -0,0 +1,831 @@ +" File: imaps.vim +" Authors: Srinath Avadhanula <srinath AT fastmail.fm> +" Benji Fisher <benji AT member.AMS.org> +" +" WWW: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vim-latex/vimfiles/plugin/imaps.vim?only_with_tag=MAIN +" +" Description: insert mode template expander with cursor placement +" while preserving filetype indentation. +" +" $Id: imaps.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Documentation: {{{ +" +" Motivation: +" this script provides a way to generate insert mode mappings which do not +" suffer from some of the problem of mappings and abbreviations while allowing +" cursor placement after the expansion. It can alternatively be thought of as +" a template expander. +" +" Consider an example. If you do +" +" imap lhs something +" +" then a mapping is set up. However, there will be the following problems: +" 1. the 'ttimeout' option will generally limit how easily you can type the +" lhs. if you type the left hand side too slowly, then the mapping will not +" be activated. +" 2. if you mistype one of the letters of the lhs, then the mapping is +" deactivated as soon as you backspace to correct the mistake. +" +" If, in order to take care of the above problems, you do instead +" +" iab lhs something +" +" then the timeout problem is solved and so is the problem of mistyping. +" however, abbreviations are only expanded after typing a non-word character. +" which causes problems of cursor placement after the expansion and invariably +" spurious spaces are inserted. +" +" Usage Example: +" this script attempts to solve all these problems by providing an emulation +" of imaps wchich does not suffer from its attendant problems. Because maps +" are activated without having to press additional characters, therefore +" cursor placement is possible. furthermore, file-type specific indentation is +" preserved, because the rhs is expanded as if the rhs is typed in literally +" by the user. +" +" The script already provides some default mappings. each "mapping" is of the +" form: +" +" call IMAP (lhs, rhs, ft) +" +" Some characters in the RHS have special meaning which help in cursor +" placement. +" +" Example One: +" +" call IMAP ("bit`", "\\begin{itemize}\<cr>\\item <++>\<cr>\\end{itemize}<++>", "tex") +" +" This effectively sets up the map for "bit`" whenever you edit a latex file. +" When you type in this sequence of letters, the following text is inserted: +" +" \begin{itemize} +" \item * +" \end{itemize}<++> +" +" where * shows the cursor position. The cursor position after inserting the +" text is decided by the position of the first "place-holder". Place holders +" are special characters which decide cursor placement and movement. In the +" example above, the place holder characters are <+ and +>. After you have typed +" in the item, press <C-j> and you will be taken to the next set of <++>'s. +" Therefore by placing the <++> characters appropriately, you can minimize the +" use of movement keys. +" +" NOTE: Set g:Imap_UsePlaceHolders to 0 to disable placeholders altogether. +" Set +" g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd +" to something else if you want different place holder characters. +" Also, b:Imap_PlaceHolderStart and b:Imap_PlaceHolderEnd override the values +" of g:Imap_PlaceHolderStart and g:Imap_PlaceHolderEnd respectively. This is +" useful for setting buffer specific place hoders. +" +" Example Two: +" You can use the <C-r> command to insert dynamic elements such as dates. +" call IMAP ('date`', "\<c-r>=strftime('%b %d %Y')\<cr>", '') +" +" sets up the map for date` to insert the current date. +" +"--------------------------------------%<-------------------------------------- +" Bonus: This script also provides a command Snip which puts tearoff strings, +" '----%<----' above and below the visually selected range of lines. The +" length of the string is chosen to be equal to the longest line in the range. +" Recommended Usage: +" '<,'>Snip +"--------------------------------------%<-------------------------------------- +" }}} + +" line continuation used here. +let s:save_cpo = &cpo +set cpo&vim + +" ============================================================================== +" Script Options / Variables +" ============================================================================== +" Options {{{ +if !exists('g:Imap_StickyPlaceHolders') + let g:Imap_StickyPlaceHolders = 1 +endif +if !exists('g:Imap_DeleteEmptyPlaceHolders') + let g:Imap_DeleteEmptyPlaceHolders = 1 +endif +" }}} +" Variables {{{ +" s:LHS_{ft}_{char} will be generated automatically. It will look like +" s:LHS_tex_o = 'fo\|foo\|boo' and contain all mapped sequences ending in "o". +" s:Map_{ft}_{lhs} will be generated automatically. It will look like +" s:Map_c_foo = 'for(<++>; <++>; <++>)', the mapping for "foo". +" +" }}} + +" ============================================================================== +" functions for easy insert mode mappings. +" ============================================================================== +" IMAP: Adds a "fake" insert mode mapping. {{{ +" For example, doing +" IMAP('abc', 'def' ft) +" will mean that if the letters abc are pressed in insert mode, then +" they will be replaced by def. If ft != '', then the "mapping" will be +" specific to the files of type ft. +" +" Using IMAP has a few advantages over simply doing: +" imap abc def +" 1. with imap, if you begin typing abc, the cursor will not advance and +" long as there is a possible completion, the letters a, b, c will be +" displayed on on top of the other. using this function avoids that. +" 2. with imap, if a backspace or arrow key is pressed before completing +" the word, then the mapping is lost. this function allows movement. +" (this ofcourse means that this function is only limited to +" left-hand-sides which do not have movement keys or unprintable +" characters) +" It works by only mapping the last character of the left-hand side. +" when this character is typed in, then a reverse lookup is done and if +" the previous characters consititute the left hand side of the mapping, +" the previously typed characters and erased and the right hand side is +" inserted + +" IMAP: set up a filetype specific mapping. +" Description: +" "maps" the lhs to rhs in files of type 'ft'. If supplied with 2 +" additional arguments, then those are assumed to be the placeholder +" characters in rhs. If unspecified, then the placeholder characters +" are assumed to be '<+' and '+>' These placeholder characters in +" a:rhs are replaced with the users setting of +" [bg]:Imap_PlaceHolderStart and [bg]:Imap_PlaceHolderEnd settings. +" +function! IMAP(lhs, rhs, ft, ...) + + " Find the place holders to save for IMAP_PutTextWithMovement() . + if a:0 < 2 + let phs = '<+' + let phe = '+>' + else + let phs = a:1 + let phe = a:2 + endif + + let hash = s:Hash(a:lhs) + let s:Map_{a:ft}_{hash} = a:rhs + let s:phs_{a:ft}_{hash} = phs + let s:phe_{a:ft}_{hash} = phe + + " Add a:lhs to the list of left-hand sides that end with lastLHSChar: + let lastLHSChar = a:lhs[strlen(a:lhs)-1] + let hash = s:Hash(lastLHSChar) + if !exists("s:LHS_" . a:ft . "_" . hash) + let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') + else + let s:LHS_{a:ft}_{hash} = escape(a:lhs, '\') .'\|'. s:LHS_{a:ft}_{hash} + endif + + " map only the last character of the left-hand side. + if lastLHSChar == ' ' + let lastLHSChar = '<space>' + end + exe 'inoremap <silent>' + \ escape(lastLHSChar, '|') + \ '<C-r>=<SID>LookupCharacter("' . + \ escape(lastLHSChar, '\|"') . + \ '")<CR>' +endfunction + +" }}} +" IMAP_list: list the rhs and place holders corresponding to a:lhs {{{ +" +" Added mainly for debugging purposes, but maybe worth keeping. +function! IMAP_list(lhs) + let char = a:lhs[strlen(a:lhs)-1] + let charHash = s:Hash(char) + if exists("s:LHS_" . &ft ."_". charHash) && a:lhs =~ s:LHS_{&ft}_{charHash} + let ft = &ft + elseif exists("s:LHS__" . charHash) && a:lhs =~ s:LHS__{charHash} + let ft = "" + else + return "" + endif + let hash = s:Hash(a:lhs) + return "rhs = " . s:Map_{ft}_{hash} . " place holders = " . + \ s:phs_{ft}_{hash} . " and " . s:phe_{ft}_{hash} +endfunction +" }}} +" LookupCharacter: inserts mapping corresponding to this character {{{ +" +" This function extracts from s:LHS_{&ft}_{a:char} or s:LHS__{a:char} +" the longest lhs matching the current text. Then it replaces lhs with the +" corresponding rhs saved in s:Map_{ft}_{lhs} . +" The place-holder variables are passed to IMAP_PutTextWithMovement() . +function! s:LookupCharacter(char) + if IMAP_GetVal('Imap_FreezeImap', 0) == 1 + return a:char + endif + let charHash = s:Hash(a:char) + + " The line so far, including the character that triggered this function: + let text = strpart(getline("."), 0, col(".")-1) . a:char + " Prefer a local map to a global one, even if the local map is shorter. + " Is this what we want? Do we care? + " Use '\V' (very no-magic) so that only '\' is special, and it was already + " escaped when building up s:LHS_{&ft}_{charHash} . + if exists("s:LHS_" . &ft . "_" . charHash) + \ && text =~ "\\C\\V\\(" . s:LHS_{&ft}_{charHash} . "\\)\\$" + let ft = &ft + elseif exists("s:LHS__" . charHash) + \ && text =~ "\\C\\V\\(" . s:LHS__{charHash} . "\\)\\$" + let ft = "" + else + " If this is a character which could have been used to trigger an + " abbreviation, check if an abbreviation exists. + if a:char !~ '\k' + let lastword = matchstr(getline('.'), '\k\+$', '') + call IMAP_Debug('getting lastword = ['.lastword.']', 'imap') + if lastword != '' + " An extremeley wierd way to get around the fact that vim + " doesn't have the equivalent of the :mapcheck() function for + " abbreviations. + let _a = @a + exec "redir @a | silent! iab ".lastword." | redir END" + let abbreviationRHS = matchstr(@a."\n", "\n".'i\s\+'.lastword.'\s\+@\?\zs.*\ze'."\n") + + call IMAP_Debug('getting abbreviationRHS = ['.abbreviationRHS.']', 'imap') + + if @a =~ "No abbreviation found" || abbreviationRHS == "" + let @a = _a + return a:char + endif + + let @a = _a + let abbreviationRHS = escape(abbreviationRHS, '\<"') + exec 'let abbreviationRHS = "'.abbreviationRHS.'"' + + let lhs = lastword.a:char + let rhs = abbreviationRHS.a:char + let phs = IMAP_GetPlaceHolderStart() + let phe = IMAP_GetPlaceHolderEnd() + else + return a:char + endif + else + return a:char + endif + endif + " Find the longest left-hand side that matches the line so far. + " matchstr() returns the match that starts first. This automatically + " ensures that the longest LHS is used for the mapping. + if !exists('lhs') || !exists('rhs') + let lhs = matchstr(text, "\\C\\V\\(" . s:LHS_{ft}_{charHash} . "\\)\\$") + let hash = s:Hash(lhs) + let rhs = s:Map_{ft}_{hash} + let phs = s:phs_{ft}_{hash} + let phe = s:phe_{ft}_{hash} + endif + + if strlen(lhs) == 0 + return a:char + endif + " enough back-spaces to erase the left-hand side; -1 for the last + " character typed: + let bs = substitute(strpart(lhs, 1), ".", "\<bs>", "g") + return bs . IMAP_PutTextWithMovement(rhs, phs, phe) +endfunction + +" }}} +" IMAP_PutTextWithMovement: returns the string with movement appended {{{ +" Description: +" If a:str contains "placeholders", then appends movement commands to +" str in a way that the user moves to the first placeholder and enters +" insert or select mode. If supplied with 2 additional arguments, then +" they are assumed to be the placeholder specs. Otherwise, they are +" assumed to be '<+' and '+>'. These placeholder chars are replaced +" with the users settings of [bg]:Imap_PlaceHolderStart and +" [bg]:Imap_PlaceHolderEnd. +function! IMAP_PutTextWithMovement(str, ...) + + " The placeholders used in the particular input string. These can be + " different from what the user wants to use. + if a:0 < 2 + let phs = '<+' + let phe = '+>' + else + let phs = escape(a:1, '\') + let phe = escape(a:2, '\') + endif + + let text = a:str + + " The user's placeholder settings. + let phsUser = IMAP_GetPlaceHolderStart() + let pheUser = IMAP_GetPlaceHolderEnd() + + " Problem: depending on the setting of the 'encoding' option, a character + " such as "\xab" may not match itself. We try to get around this by + " changing the encoding of all our strings. At the end, we have to + " convert text back. + let phsEnc = s:Iconv(phs, "encode") + let pheEnc = s:Iconv(phe, "encode") + let phsUserEnc = s:Iconv(phsUser, "encode") + let pheUserEnc = s:Iconv(pheUser, "encode") + let textEnc = s:Iconv(text, "encode") + if textEnc != text + let textEncoded = 1 + else + let textEncoded = 0 + endif + + let pattern = '\V\(\.\{-}\)' .phs. '\(\.\{-}\)' .phe. '\(\.\*\)' + " If there are no placeholders, just return the text. + if textEnc !~ pattern + call IMAP_Debug('Not getting '.phs.' and '.phe.' in '.textEnc, 'imap') + return text + endif + " Break text up into "initial <+template+> final"; any piece may be empty. + let initialEnc = substitute(textEnc, pattern, '\1', '') + let templateEnc = substitute(textEnc, pattern, '\2', '') + let finalEnc = substitute(textEnc, pattern, '\3', '') + + " If the user does not want to use placeholders, then remove all but the + " first placeholder. + " Otherwise, replace all occurences of the placeholders here with the + " user's choice of placeholder settings. + if exists('g:Imap_UsePlaceHolders') && !g:Imap_UsePlaceHolders + let finalEnc = substitute(finalEnc, '\V'.phs.'\.\{-}'.phe, '', 'g') + else + let finalEnc = substitute(finalEnc, '\V'.phs.'\(\.\{-}\)'.phe, + \ phsUserEnc.'\1'.pheUserEnc, 'g') + endif + + " The substitutions are done, so convert back, if necessary. + if textEncoded + let initial = s:Iconv(initialEnc, "decode") + let template = s:Iconv(templateEnc, "decode") + let final = s:Iconv(finalEnc, "decode") + else + let initial = initialEnc + let template = templateEnc + let final = finalEnc + endif + + " Build up the text to insert: + " 1. the initial text plus an extra character; + " 2. go to Normal mode with <C-\><C-N>, so it works even if 'insertmode' + " is set, and mark the position; + " 3. replace the extra character with tamplate and final; + " 4. back to Normal mode and restore the cursor position; + " 5. call IMAP_Jumpfunc(). + let template = phsUser . template . pheUser + " Old trick: insert and delete a character to get the same behavior at + " start, middle, or end of line and on empty lines. + let text = initial . "X\<C-\>\<C-N>:call IMAP_Mark('set')\<CR>\"_s" + let text = text . template . final + let text = text . "\<C-\>\<C-N>:call IMAP_Mark('go')\<CR>" + let text = text . "i\<C-r>=IMAP_Jumpfunc('', 1)\<CR>" + + call IMAP_Debug('IMAP_PutTextWithMovement: text = ['.text.']', 'imap') + return text +endfunction + +" }}} +" IMAP_Jumpfunc: takes user to next <+place-holder+> {{{ +" Author: Luc Hermitte +" Arguments: +" direction: flag for the search() function. If set to '', search forwards, +" if 'b', then search backwards. See the {flags} argument of the +" |search()| function for valid values. +" inclusive: In vim, the search() function is 'exclusive', i.e we always goto +" next cursor match even if there is a match starting from the +" current cursor position. Setting this argument to 1 makes +" IMAP_Jumpfunc() also respect a match at the current cursor +" position. 'inclusive'ness is necessary for IMAP() because a +" placeholder string can occur at the very beginning of a map which +" we want to select. +" We use a non-zero value only in special conditions. Most mappings +" should use a zero value. +function! IMAP_Jumpfunc(direction, inclusive) + + " The user's placeholder settings. + let phsUser = IMAP_GetPlaceHolderStart() + let pheUser = IMAP_GetPlaceHolderEnd() + + let searchString = '' + " If this is not an inclusive search or if it is inclusive, but the + " current cursor position does not contain a placeholder character, then + " search for the placeholder characters. + if !a:inclusive || strpart(getline('.'), col('.')-1) !~ '\V\^'.phsUser + let searchString = '\V'.phsUser.'\_.\{-}'.pheUser + endif + + " If we didn't find any placeholders return quietly. + if searchString != '' && !search(searchString, a:direction) + return '' + endif + + " Open any closed folds and make this part of the text visible. + silent! foldopen! + + " Calculate if we have an empty placeholder or if it contains some + " description. + let template = + \ matchstr(strpart(getline('.'), col('.')-1), + \ '\V\^'.phsUser.'\zs\.\{-}\ze\('.pheUser.'\|\$\)') + let placeHolderEmpty = !strlen(template) + + " If we are selecting in exclusive mode, then we need to move one step to + " the right + let extramove = '' + if &selection == 'exclusive' + let extramove = 'l' + endif + + " Select till the end placeholder character. + let movement = "\<C-o>v/\\V".pheUser."/e\<CR>".extramove + + " First remember what the search pattern was. s:RemoveLastHistoryItem will + " reset @/ to this pattern so we do not create new highlighting. + let g:Tex_LastSearchPattern = @/ + + " Now either goto insert mode or select mode. + if placeHolderEmpty && g:Imap_DeleteEmptyPlaceHolders + " delete the empty placeholder into the blackhole. + return movement."\"_c\<C-o>:".s:RemoveLastHistoryItem."\<CR>" + else + return movement."\<C-\>\<C-N>:".s:RemoveLastHistoryItem."\<CR>gv\<C-g>" + endif + +endfunction + +" }}} +" Maps for IMAP_Jumpfunc {{{ +" +" These mappings use <Plug> and thus provide for easy user customization. When +" the user wants to map some other key to jump forward, he can do for +" instance: +" nmap ,f <plug>IMAP_JumpForward +" etc. + +" jumping forward and back in insert mode. +imap <silent> <Plug>IMAP_JumpForward <c-r>=IMAP_Jumpfunc('', 0)<CR> +imap <silent> <Plug>IMAP_JumpBack <c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" jumping in normal mode +nmap <silent> <Plug>IMAP_JumpForward i<c-r>=IMAP_Jumpfunc('', 0)<CR> +nmap <silent> <Plug>IMAP_JumpBack i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" deleting the present selection and then jumping forward. +vmap <silent> <Plug>IMAP_DeleteAndJumpForward "_<Del>i<c-r>=IMAP_Jumpfunc('', 0)<CR> +vmap <silent> <Plug>IMAP_DeleteAndJumpBack "_<Del>i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" jumping forward without deleting present selection. +vmap <silent> <Plug>IMAP_JumpForward <C-\><C-N>i<c-r>=IMAP_Jumpfunc('', 0)<CR> +vmap <silent> <Plug>IMAP_JumpBack <C-\><C-N>`<i<c-r>=IMAP_Jumpfunc('b', 0)<CR> + +" }}} +" Default maps for IMAP_Jumpfunc {{{ +" map only if there is no mapping already. allows for user customization. +" NOTE: Default mappings for jumping to the previous placeholder are not +" provided. It is assumed that if the user will create such mappings +" hself if e so desires. +if !hasmapto('<Plug>IMAP_JumpForward', 'i') + imap <C-J> <Plug>IMAP_JumpForward +endif +if !hasmapto('<Plug>IMAP_JumpForward', 'n') + nmap <C-J> <Plug>IMAP_JumpForward +endif +if exists('g:Imap_StickyPlaceHolders') && g:Imap_StickyPlaceHolders + if !hasmapto('<Plug>IMAP_JumpForward', 'v') + vmap <C-J> <Plug>IMAP_JumpForward + endif +else + if !hasmapto('<Plug>IMAP_DeleteAndJumpForward', 'v') + vmap <C-J> <Plug>IMAP_DeleteAndJumpForward + endif +endif +" }}} + +nmap <silent> <script> <plug><+SelectRegion+> `<v`> + +" ============================================================================== +" enclosing selected region. +" ============================================================================== +" VEnclose: encloses the visually selected region with given arguments {{{ +" Description: allows for differing action based on visual line wise +" selection or visual characterwise selection. preserves the +" marks and search history. +function! VEnclose(vstart, vend, VStart, VEnd) + + " its characterwise if + " 1. characterwise selection and valid values for vstart and vend. + " OR + " 2. linewise selection and invalid values for VStart and VEnd + if (visualmode() ==# 'v' && (a:vstart != '' || a:vend != '')) || (a:VStart == '' && a:VEnd == '') + + let newline = "" + let _r = @r + + let normcmd = "normal! \<C-\>\<C-n>`<v`>\"_s" + + exe "normal! \<C-\>\<C-n>`<v`>\"ry" + if @r =~ "\n$" + let newline = "\n" + let @r = substitute(@r, "\n$", '', '') + endif + + " In exclusive selection, we need to select an extra character. + if &selection == 'exclusive' + let movement = 8 + else + let movement = 7 + endif + let normcmd = normcmd. + \ a:vstart."!!mark!!".a:vend.newline. + \ "\<C-\>\<C-N>?!!mark!!\<CR>v".movement."l\"_s\<C-r>r\<C-\>\<C-n>" + + " this little if statement is because till very recently, vim used to + " report col("'>") > length of selected line when `> is $. on some + " systems it reports a -ve number. + if col("'>") < 0 || col("'>") > strlen(getline("'>")) + let lastcol = strlen(getline("'>")) + else + let lastcol = col("'>") + endif + if lastcol - col("'<") != 0 + let len = lastcol - col("'<") + else + let len = '' + endif + + " the next normal! is for restoring the marks. + let normcmd = normcmd."`<v".len."l\<C-\>\<C-N>" + + " First remember what the search pattern was. s:RemoveLastHistoryItem + " will reset @/ to this pattern so we do not create new highlighting. + let g:Tex_LastSearchPattern = @/ + + silent! exe normcmd + " this is to restore the r register. + let @r = _r + " and finally, this is to restore the search history. + execute s:RemoveLastHistoryItem + + else + + exec 'normal! `<O'.a:VStart."\<C-\>\<C-n>" + exec 'normal! `>o'.a:VEnd."\<C-\>\<C-n>" + if &indentexpr != '' + silent! normal! `<kV`>j= + endif + silent! normal! `> + endif +endfunction + +" }}} +" ExecMap: adds the ability to correct an normal/visual mode mapping. {{{ +" Author: Hari Krishna Dara <hari_vim@yahoo.com> +" Reads a normal mode mapping at the command line and executes it with the +" given prefix. Press <BS> to correct and <Esc> to cancel. +function! ExecMap(prefix, mode) + " Temporarily remove the mapping, otherwise it will interfere with the + " mapcheck call below: + let myMap = maparg(a:prefix, a:mode) + exec a:mode."unmap ".a:prefix + + " Generate a line with spaces to clear the previous message. + let i = 1 + let clearLine = "\r" + while i < &columns + let clearLine = clearLine . ' ' + let i = i + 1 + endwhile + + let mapCmd = a:prefix + let foundMap = 0 + let breakLoop = 0 + echon "\rEnter Map: " . mapCmd + while !breakLoop + let char = getchar() + if char !~ '^\d\+$' + if char == "\<BS>" + let mapCmd = strpart(mapCmd, 0, strlen(mapCmd) - 1) + endif + else " It is the ascii code. + let char = nr2char(char) + if char == "\<Esc>" + let breakLoop = 1 + else + let mapCmd = mapCmd . char + if maparg(mapCmd, a:mode) != "" + let foundMap = 1 + let breakLoop = 1 + elseif mapcheck(mapCmd, a:mode) == "" + let mapCmd = strpart(mapCmd, 0, strlen(mapCmd) - 1) + endif + endif + endif + echon clearLine + echon "\rEnter Map: " . mapCmd + endwhile + if foundMap + if a:mode == 'v' + " use a plug to select the region instead of using something like + " `<v`> to avoid problems caused by some of the characters in + " '`<v`>' being mapped. + let gotoc = "\<plug><+SelectRegion+>" + else + let gotoc = '' + endif + exec "normal ".gotoc.mapCmd + endif + exec a:mode.'noremap '.a:prefix.' '.myMap +endfunction + +" }}} + +" ============================================================================== +" helper functions +" ============================================================================== +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} +" s:RemoveLastHistoryItem: removes last search item from search history {{{ +" Description: Execute this string to clean up the search history. +let s:RemoveLastHistoryItem = ':call histdel("/", -1)|let @/=g:Tex_LastSearchPattern' + +" }}} +" s:Hash: Return a version of a string that can be used as part of a variable" {{{ +" name. +" Converts every non alphanumeric character into _{ascii}_ where {ascii} is +" the ASCII code for that character... +fun! s:Hash(text) + return substitute(a:text, '\([^[:alnum:]]\)', + \ '\="_".char2nr(submatch(1))."_"', 'g') +endfun +"" }}} +" IMAP_GetPlaceHolderStart and IMAP_GetPlaceHolderEnd: "{{{ +" return the buffer local placeholder variables, or the global one, or the default. +function! IMAP_GetPlaceHolderStart() + if exists("b:Imap_PlaceHolderStart") && strlen(b:Imap_PlaceHolderEnd) + return b:Imap_PlaceHolderStart + elseif exists("g:Imap_PlaceHolderStart") && strlen(g:Imap_PlaceHolderEnd) + return g:Imap_PlaceHolderStart + else + return "<+" +endfun +function! IMAP_GetPlaceHolderEnd() + if exists("b:Imap_PlaceHolderEnd") && strlen(b:Imap_PlaceHolderEnd) + return b:Imap_PlaceHolderEnd + elseif exists("g:Imap_PlaceHolderEnd") && strlen(g:Imap_PlaceHolderEnd) + return g:Imap_PlaceHolderEnd + else + return "+>" +endfun +" }}} +" s:Iconv: a wrapper for iconv()" {{{ +" Problem: after +" let text = "\xab" +" (or using the raw 8-bit ASCII character in a file with 'fenc' set to +" "latin1") if 'encoding' is set to utf-8, then text does not match itself: +" echo text =~ text +" returns 0. +" Solution: When this happens, a re-encoded version of text does match text: +" echo iconv(text, "latin1", "utf8") =~ text +" returns 1. In this case, convert text to utf-8 with iconv(). +" TODO: Is it better to use &encoding instead of "utf8"? Internally, vim +" uses utf-8, and can convert between latin1 and utf-8 even when compiled with +" -iconv, so let's try using utf-8. +" Arguments: +" a:text = text to be encoded or decoded +" a:mode = "encode" (latin1 to utf8) or "decode" (utf8 to latin1) +" Caution: do not encode and then decode without checking whether the text +" has changed, becuase of the :if clause in encoding! +function! s:Iconv(text, mode) + if a:mode == "decode" + return iconv(a:text, "utf8", "latin1") + endif + if a:text =~ '\V\^' . escape(a:text, '\') . '\$' + return a:text + endif + let textEnc = iconv(a:text, "latin1", "utf8") + if textEnc !~ '\V\^' . escape(a:text, '\') . '\$' + call IMAP_Debug('Encoding problems with text '.a:text.' ', 'imap') + endif + return textEnc +endfun +"" }}} +" IMAP_Debug: interface to Tex_Debug if available, otherwise emulate it {{{ +" Description: +" Do not want a memory leak! Set this to zero so that imaps always +" starts out in a non-debugging mode. +if !exists('g:Imap_Debug') + let g:Imap_Debug = 0 +endif +function! IMAP_Debug(string, pattern) + if !g:Imap_Debug + return + endif + if exists('*Tex_Debug') + call Tex_Debug(a:string, a:pattern) + else + if !exists('s:debug_'.a:pattern) + let s:debug_{a:pattern} = a:string + else + let s:debug_{a:pattern} = s:debug_{a:pattern}.a:string + endif + endif +endfunction " }}} +" IMAP_DebugClear: interface to Tex_DebugClear if avaialable, otherwise emulate it {{{ +" Description: +function! IMAP_DebugClear(pattern) + if exists('*Tex_DebugClear') + call Tex_DebugClear(a:pattern) + else + let s:debug_{a:pattern} = '' + endif +endfunction " }}} +" IMAP_PrintDebug: interface to Tex_DebugPrint if avaialable, otherwise emulate it {{{ +" Description: +function! IMAP_PrintDebug(pattern) + if exists('*Tex_PrintDebug') + call Tex_PrintDebug(a:pattern) + else + if exists('s:debug_'.a:pattern) + echo s:debug_{a:pattern} + endif + endif +endfunction " }}} +" IMAP_Mark: Save the cursor position (if a:action == 'set') in a" {{{ +" script-local variable; restore this position if a:action == 'go'. +let s:Mark = "(0,0)" +let s:initBlanks = '' +function! IMAP_Mark(action) + if a:action == 'set' + let s:Mark = "(" . line(".") . "," . col(".") . ")" + let s:initBlanks = matchstr(getline('.'), '^\s*') + elseif a:action == 'go' + execute "call cursor" s:Mark + let blanksNow = matchstr(getline('.'), '^\s*') + if strlen(blanksNow) > strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(blanksNow) - strlen(s:initBlanks)).'l' + elseif strlen(blanksNow) < strlen(s:initBlanks) + execute 'silent! normal! '.(strlen(s:initBlanks) - strlen(blanksNow)).'h' + endif + endif +endfunction "" }}} +" IMAP_GetVal: gets the value of a variable {{{ +" Description: first checks window local, then buffer local etc. +function! IMAP_GetVal(name, ...) + if a:0 > 0 + let default = a:1 + else + let default = '' + endif + if exists('w:'.a:name) + return w:{a:name} + elseif exists('b:'.a:name) + return b:{a:name} + elseif exists('g:'.a:name) + return g:{a:name} + else + return default + endif +endfunction " }}} + +" ============================================================================== +" A bonus function: Snip() +" ============================================================================== +" Snip: puts a scissor string above and below block of text {{{ +" Desciption: +"-------------------------------------%<------------------------------------- +" this puts a the string "--------%<---------" above and below the visually +" selected block of lines. the length of the 'tearoff' string depends on the +" maximum string length in the selected range. this is an aesthetically more +" pleasing alternative instead of hardcoding a length. +"-------------------------------------%<------------------------------------- +function! <SID>Snip() range + let i = a:firstline + let maxlen = -2 + " find out the maximum virtual length of each line. + while i <= a:lastline + exe i + let length = virtcol('$') + let maxlen = (length > maxlen ? length : maxlen) + let i = i + 1 + endwhile + let maxlen = (maxlen > &tw && &tw != 0 ? &tw : maxlen) + let half = maxlen/2 + exe a:lastline + " put a string below + exe "norm! o\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-" + " and above. its necessary to put the string below the block of lines + " first because that way the first line number doesnt change... + exe a:firstline + exe "norm! O\<esc>".(half - 1)."a-\<esc>A%<\<esc>".(half - 1)."a-" +endfunction + +com! -nargs=0 -range Snip :<line1>,<line2>call <SID>Snip() +" }}} + +let &cpo = s:save_cpo + +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:nowrap diff --git a/vim-latex/plugin/libList.vim b/vim-latex/plugin/libList.vim new file mode 100644 index 0000000..7d72c3e --- /dev/null +++ b/vim-latex/plugin/libList.vim @@ -0,0 +1,249 @@ +" File: libList.vim +" Last Change: 2001 Dec 10 +" Maintainer: Gontran BAERTS <gbcreation@free.fr> +" Version: 0.1 +" +" Please don't hesitate to correct my english :) +" Send corrections to <gbcreation@free.fr> +" +"----------------------------------------------------------------------------- +" Description: libList.vim is a set of functions to work with lists or one +" level arrays. +" +"----------------------------------------------------------------------------- +" To Enable: Normally, this file will reside in your plugins directory and be +" automatically sourced. +" +"----------------------------------------------------------------------------- +" Usage: Lists are strings variable with values separated by g:listSep +" character (comma" by default). You may redefine g:listSep variable as you +" wish. +" +" Here are available functions : +" +" - AddListItem( array, newItem, index ) : +" Add item "newItem" to array "array" at "index" position +" - GetListItem( array, index ) : +" Return item at "index" position in array "array" +" - GetListMatchItem( array, pattern ) : +" Return item matching "pattern" in array "array" +" - GetListCount( array ) : +" Return the number of items in array "array" +" - RemoveListItem( array, index ) : +" Remove item at "index" position from array "array" +" - ReplaceListItem( array, index, item ) : +" Remove item at "index" position by "item" in array "array" +" - ExchangeListItems( array, item1Index, item2Index ) : +" Exchange item "item1Index" with item "item2Index" in array "array" +" - QuickSortList( array, beg, end ) : +" Return array "array" with items between "beg" and "end" sorted +" +" Example: +" let mylist="" +" echo GetListCount( mylist ) " --> 0 +" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One" +" let mylist = AddListItem( mylist, "Three", 1 ) " mylist == "One,Three" +" let mylist = AddListItem( mylist, "Two", 1 ) " mylist == "One,Two,Three" +" echo GetListCount( mylist ) " --> 3 +" echo GetListItem( mylist, 2 ) " --> Three +" echo GetListMatchItem( mylist, "w" ) " --> two +" echo GetListMatchItem( mylist, "e" ) " --> One +" let mylist = RemoveListItem( mylist, 2 ) " mylist == "One,Two" +" echo GetListCount( mylist ) " --> 2 +" let mylist = ReplaceListItem( mylist, 0, "Three" ) " mylist == "Three,Two" +" let mylist = ExchangeListItems( mylist, 0, 1 ) " mylist == "Two,Three" +" let mylist = AddListItem( mylist, "One", 0 ) " mylist == "One,Two,Three" +" let mylist = QuickSortList( mylist, 0, GetListCount(mylist)-1 ) +" " mylist == "One,Three,Two" +" +"----------------------------------------------------------------------------- +" Updates: +" in version 0.1 +" - First version + +" Has this already been loaded ? +if exists("loaded_libList") + finish +endif +let loaded_libList=1 + +"** +" Separator: +" You may change the separator character et any time. +"** +let g:listSep = "," + +"** +"AddListItem: +" Add new item at given position. +" First item index is 0 (zero). +"Parameters: +" - array : Array/List (string of values) which receives the new item. +" - newItem : String containing the item value to add. +" - index : Integer indicating the position at which the new item is added. +" It must be greater than or equals to 0 (zero). +"Return: +"String containing array values, including newItem. +"** +function AddListItem( array, newItem, index ) + if a:index == 0 + if a:array == "" + return a:newItem + endif + return a:newItem . g:listSep . a:array + endif + return substitute( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}', '\0' . g:listSep . a:newItem , "" ) +endfunction + +"** +"GetListItem: +" Get item at given position. +"Parameters: +" - array : Array/List (string of values). +" - index : Integer indicating the position of item to return. +" It must be greater than or equals to 0 (zero). +"Return: +"String representing the item. +"** +function GetListItem( array, index ) + if a:index == 0 + return matchstr( a:array, '^[^' . g:listSep . ']\+' ) + else + return matchstr( a:array, "[^" . g:listSep . "]\\+", matchend( a:array, '\(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}' . g:listSep ) ) + endif +endfunction + +"** +"GetListMatchItem: +" Get the first item matching given pattern. +"Parameters: +" - array : Array/List (string of values). +" - pattern : Regular expression to match with items. +" Avoid to use ^, $ and listSep characters in pattern, unless you +" know what you do. +"Return: +"String representing the first item that matches the pattern. +"** +function GetListMatchItem( array, pattern ) + return matchstr( a:array, '[^' . g:listSep . ']*' . a:pattern . '[^' . g:listSep . ']*' ) +endfunction + +"** +"ReplaceListItem: +" Replace item at given position by a new one. +"Parameters: +" - array : Array/List (string of values). +" - index : Integer indicating the position of item to replace. +" It must be greater than or equals to 0 (zero). +" - item : String containing the new value of the replaced item. +"Return: +"String containing array values. +"** +function ReplaceListItem( array, index, item ) + if a:index == 0 + return substitute( a:array, '^[^' .g:listSep. ']\+', a:item, "" ) + else + return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1' . g:listSep . a:item , "" ) + endif +endfunction + +"** +"RemoveListItem: +" Remove item at given position. +"Parameters: +" - array : Array/List (string of values) from which remove an item. +" - index : Integer indicating the position of item to remove. +" It must be greater than or equals to 0 (zero). +"Return: +"String containing array values, except the removed one. +"** +function RemoveListItem( array, index ) + if a:index == 0 + return substitute( a:array, '^[^' .g:listSep. ']\+\(' . g:listSep . '\|$\)', "", "" ) + else + return substitute( a:array, '\(\%(\%(^\|' . g:listSep . '\)[^' . g:listSep . ']\+\)\{' . a:index . '\}\)' . g:listSep . '[^' . g:listSep . ']\+', '\1', "" ) + endif +endfunction + +"** +"ExchangeListItems: +" Exchange item at position item1Index with item at position item2Index. +"Parameters: +" - array : Array/List (string of values). +" - item1index : Integer indicating the position of the first item to exchange. +" It must be greater than or equals to 0 (zero). +" - item2index : Integer indicating the position of the second item to +" exchange. It must be greater than or equals to 0 (zero). +"Return: +"String containing array values. +"** +function ExchangeListItems( array, item1Index, item2Index ) + let item1 = GetListItem( a:array, a:item1Index ) + let array = ReplaceListItem( a:array, a:item1Index, GetListItem( a:array, a:item2Index ) ) + return ReplaceListItem( array, a:item2Index, item1 ) +endfunction + +"** +"GetListCount: +" Number of items in array. +"Parameters: +" - array : Array/List (string of values). +"Return: +"Integer representing the number of items in array. +"Index of last item is GetListCount(array)-1. +"** +function GetListCount( array ) + if a:array == "" | return 0 | endif + let pos = 0 + let cnt = 0 + while pos != -1 + let pos = matchend( a:array, g:listSep, pos ) + let cnt = cnt + 1 + endwhile + return cnt +endfunction + +"** +"QuickSortList: +" Sort array. +"Parameters: +" - array : Array/List (string of values). +" - beg : Min index of the range of items to sort. +" - end : Max index of the range of items to sort. +"Return: +"String containing array values with indicated range of items sorted. +"** +function QuickSortList( array, beg, end ) + let array = a:array + let pivot = GetListItem( array, a:beg ) + let l = a:beg + let r = a:end + while l < r + while GetListItem( array, r ) > pivot + let r = r - 1 + endwhile + if l != r + let array = ReplaceListItem( array, l, GetListItem( array, r ) ) + let array = ReplaceListItem( array, r, pivot ) + let l = l + 1 + endif + + while GetListItem( array, l ) < pivot + let l = l + 1 + endwhile + if l != r + let array = ReplaceListItem( array, r, GetListItem( array, l ) ) + let array = ReplaceListItem( array, l, pivot ) + let r = r - 1 + endif + endwhile + if a:beg < l-1 + let array = QuickSortList( array, a:beg, l-1 ) + endif + if a:end > l+1 + let array = QuickSortList( array, l+1, a:end ) + endif + return array +endfunction + + diff --git a/vim-latex/plugin/remoteOpen.vim b/vim-latex/plugin/remoteOpen.vim new file mode 100644 index 0000000..6293618 --- /dev/null +++ b/vim-latex/plugin/remoteOpen.vim @@ -0,0 +1,163 @@ +" File: remoteOpen.vim +" Author: Srinath Avadhanula <srinath AT fastmail DOT fm> +" $Id: remoteOpen.vim 1080 2010-01-26 22:02:34Z tmaas $ +" +" Description: +" Often times, an external program needs to open a file in gvim from the +" command line. However, it will not know if the file is already opened in a +" previous vim session. It is not sufficient to simply specify +" +" gvim --remote-silent <filename> +" +" because this simply opens up <filename> in the first remote gvim session it +" sees. This script provides a command RemoteOpen which is meant to be used +" from the command line as follows: +" +" gvim -c ":RemoteOpen +<lnum> <filename>" +" +" where <lnum> is the line-number you wish <filename> to open to. What will +" happen is that a new gvim will start up and enquire from all previous +" sessions if <filename> is already open in any of them. If it is, then it +" will edit the file in that session and bring it to the foreground and itself +" quit. Otherwise, it will not quit and instead open up the file for editing +" at <lnum>. +" +" This was mainly created to be used with Yap (the dvi previewer in miktex), +" so you can specify the program for "inverse search" as specified above. +" This ensures that the inverse search uses the correct gvim each time. +" +" Ofcourse, this requires vim with +clientserver. If not, then RemoteOpen just +" opens in the present session. + +" Enclose <args> in single quotes so it can be passed as a function argument. +com! -nargs=1 RemoteOpen :call RemoteOpen('<args>') +com! -nargs=? RemoteInsert :call RemoteInsert('<args>') + +" RemoteOpen: open a file remotely (if possible) {{{ +" Description: checks all open vim windows to see if this file has been opened +" anywhere and if so, opens it there instead of in this session. +function! RemoteOpen(arglist) + + " First construct line number and filename from argument. a:arglist is of + " the form: + " +10 c:\path\to\file + " or just + " c:\path\to\file + if a:arglist =~ '^\s*+\d\+' + let linenum = matchstr(a:arglist, '^\s*+\zs\d\+\ze') + let filename = matchstr(a:arglist, '^\s*+\d\+\s*\zs.*\ze') + else + let linenum = 1 + let filename = matchstr(a:arglist, '^\s*\zs.*\ze') + endif + let filename = escape(filename, ' ') + call Tex_Debug("linenum = ".linenum.', filename = '.filename, "ropen") + + " If there is no clientserver functionality, then just open in the present + " session and return + if !has('clientserver') + call Tex_Debug("-clientserver, opening locally and returning", "ropen") + exec "e ".filename + exec linenum + normal! zv + return + endif + + " Otherwise, loop through all available servers + let servers = serverlist() + " If there are no servers, open file locally. + if servers == '' + call Tex_Debug("no open servers, opening locally", "ropen") + exec "e ".filename + exec linenum + let g:Remote_Server = 1 + normal! zv + return + endif + + let i = 1 + let server = s:Strntok(servers, "\n", i) + let targetServer = v:servername + + while server != '' + " Find out if there was any server which was used by remoteOpen before + " this. If a new gvim session was ever started via remoteOpen, then + " g:Remote_Server will be set. + if remote_expr(server, 'exists("g:Remote_Server")') + let targetServer = server + endif + + " Ask each server if that file is being edited by them. + let bufnum = remote_expr(server, "bufnr('".filename."')") + " If it is... + if bufnum != -1 + " ask the server to edit that file and come to the foreground. + " set a variable g:Remote_Server to indicate that this server + " session has at least one file opened via RemoteOpen + let targetServer = server + break + end + + let i = i + 1 + let server = s:Strntok(servers, "\n", i) + endwhile + + " If none of the servers have the file open, then open this file in the + " first server. This has the advantage if yap tries to make vim open + " multiple vims, then at least they will all be opened by the same gvim + " server. + call remote_send(targetServer, + \ "\<C-\>\<C-n>". + \ ":let g:Remote_Server = 1\<CR>". + \ ":drop ".filename."\<CR>". + \ ":".linenum."\<CR>zv" + \ ) + call remote_foreground(targetServer) + " quit this vim session + if v:servername != targetServer + q + endif +endfunction " }}} +" RemoteInsert: inserts a \cite'ation remotely (if possible) {{{ +" Description: +function! RemoteInsert(...) + + let citation = matchstr(argv(0), "\\[InsText('.cite{\\zs.\\{-}\\ze}');\\]") + if citation == "" + q + endif + + " Otherwise, loop through all available servers + let servers = serverlist() + + let i = 1 + let server = s:Strntok(servers, "\n", i) + let targetServer = v:servername + + while server != '' + if remote_expr(server, 'exists("g:Remote_WaitingForCite")') + call remote_send(server, citation . "\<CR>") + call remote_foreground(server) + if v:servername != server + q + else + return + endif + endif + + let i = i + 1 + let server = s:Strntok(servers, "\n", i) + endwhile + + q + +endfunction " }}} +" Strntok: extract the n^th token from a list {{{ +" example: Strntok('1,23,3', ',', 2) = 23 +fun! <SID>Strntok(s, tok, n) + return matchstr( a:s.a:tok[0], '\v(\zs([^'.a:tok.']*)\ze['.a:tok.']){'.a:n.'}') +endfun + +" }}} + +" vim:ft=vim:ts=4:sw=4:noet:fdm=marker:commentstring=\"\ %s:nowrap |
