pax_global_header00006660000000000000000000000064120755351200014512gustar00rootroot0000000000000052 comment=2ef995684d6addfa96d605b4ffbc6b6d500151fa vim-latex-1.8.23-20130116.788-git2ef9956/000077500000000000000000000000001207553512000164465ustar00rootroot00000000000000vim-latex-1.8.23-20130116.788-git2ef9956/.gitignore000066400000000000000000000011571207553512000204420ustar00rootroot00000000000000## 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 vim-latex-1.8.23-20130116.788-git2ef9956/Makefile000066400000000000000000000015501207553512000201070ustar00rootroot00000000000000PREFIX=/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 vim-latex-1.8.23-20130116.788-git2ef9956/Makefile.in000066400000000000000000000104341207553512000205150ustar00rootroot00000000000000CVSUSER = 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 vim-latex-1.8.23-20130116.788-git2ef9956/compiler/000077500000000000000000000000001207553512000202605ustar00rootroot00000000000000vim-latex-1.8.23-20130116.788-git2ef9956/compiler/tex.vim000066400000000000000000000247761207553512000216150ustar00rootroot00000000000000" File: tex.vim " Type: compiler plugin for LaTeX " Original Author: Artem Chuprina " Customization: Srinath Avadhanula " 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 " 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! 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! 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\ %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! 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! 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 SetTexCompilerLevel() " }}} " }}} " ============================================================================== 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/000077500000000000000000000000001207553512000172135ustar00rootroot00000000000000vim-latex-1.8.23-20130116.788-git2ef9956/doc/Makefile000066400000000000000000000032651207553512000206610ustar00rootroot00000000000000projects = 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/Makefile.in000066400000000000000000000013111207553512000212540ustar00rootroot00000000000000# 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/README000066400000000000000000000072661207553512000201060ustar00rootroot00000000000000!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/README.new000066400000000000000000000006371207553512000206710ustar00rootroot00000000000000==================================== 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. vim-latex-1.8.23-20130116.788-git2ef9956/doc/catalog.xml000066400000000000000000000010171207553512000213460ustar00rootroot00000000000000 vim-latex-1.8.23-20130116.788-git2ef9956/doc/db2vim/000077500000000000000000000000001207553512000203765ustar00rootroot00000000000000vim-latex-1.8.23-20130116.788-git2ef9956/doc/db2vim/db2vim000077500000000000000000000562611207553512000215210ustar00rootroot00000000000000#!/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= 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/db2vim/domutils.py000066400000000000000000000011221207553512000226040ustar00rootroot00000000000000def 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/db2vim/textutils.py000066400000000000000000000153651207553512000230270ustar00rootroot00000000000000#!/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 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 vim-latex-1.8.23-20130116.788-git2ef9956/doc/imaps.txt000066400000000000000000000112211207553512000210620ustar00rootroot00000000000000 IMAP -- A fluid replacement for :imap *imaps.txt* Srinath Avadhanula 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 map to for all files of type . Some characters in the 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}\\\item <++>\\\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 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 command to insert dynamic elements such as dates. > call IMAP ('date`', "\=strftime('%b %d %Y')\", '') 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*\\*.*',"",""),'^--','--\ \ \ \ ','') ================================================================================ vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite-chunk.xsl000066400000000000000000000032351207553512000233200ustar00rootroot00000000000000 2 appendix toc article/appendix toc article toc sect1 toc sect2 toc sect3 toc sect4 toc sect5 toc section toc vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite-common.xsl000066400000000000000000000036711207553512000235040ustar00rootroot00000000000000 3 2
vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite-quickstart.css000066400000000000000000000061301207553512000243610ustar00rootroot00000000000000/* * 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" */ } vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite-quickstart.txt000066400000000000000000000510431207553512000244130ustar00rootroot00000000000000 A (very) quick introduction to Latex-Suite *latex-suite-quickstart.txt* Srinath Avadhanula 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 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 . 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 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 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 . (Remember: is very useful!) This time, the line will change to: > \begin{eqnarray} \label{}<++> \end{eqnarray}<++> . 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 . 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 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 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 . The line which you were editing will change to: > This is a reference to (\ref{eqn:euler}) 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 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*\\*.*',"",""),'^--','\ \ \ \ \ \ ','') ================================================================================ vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite-quickstart.xml000066400000000000000000000504021207553512000243720ustar00rootroot00000000000000 ]>
A (very) quick introduction to Latex-Suite Srinath Avadhanula
srinath AT fastmail DOT fm
&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;. &date;
Using this 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. Assuming you have Vim 6.1+ already up and running, follow the instructions here 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 &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.
Inserting a 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 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}&ph; with the cursor positioned conveniently between the []'s. For now, do not worry about the trailing &ph; 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}&ph; 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 &ph; will disappear. What just happened?! You had your first taste of Placeholders. Read more about them (later) here. In short, pressing <C-j> in insert mode takes you to the next &ph; in the text.
Inserting an 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{}&ph; \end{eqnarray}&ph; 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 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^{}&ph; with the cursor between {}'s. (The ^^ changed to ^{}&ph;.) 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. 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 &ls; 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 &ls; 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 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 for more information.
Compiling a document 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.
Debugging LaTeX source files 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. The 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 for more.
Viewing DVI files 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.
Performing forward searches 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. 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 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 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 &ls; user manual.
vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite.css000066400000000000000000000061301207553512000221710ustar00rootroot00000000000000/* * 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" */ } vim-latex-1.8.23-20130116.788-git2ef9956/doc/latex-suite.txt000066400000000000000000004554641207553512000222420ustar00rootroot00000000000000 Latex-Suite Reference *latex-suite.txt* Srinath Avadhanula Mikolaj Machowski 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 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 (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 *ls_3_1_1_1* *ls_a_bh* *inserting-env-f5* If you press 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 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 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 - *ls_3_1_1_2* *ls_a_bi* *inserting-env-shift-f1* The shifted function keys, to 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 *ls_3_1_2_1* *ls_a_bl* *enclosing-env-f5* You can also select a portion of text visually and press 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 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 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 in normal mode has the same effect as pressing 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 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 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 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 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 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. > + expands to \v{} = expands to \'{} where 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 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 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 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 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 key. NOTE: By default, typing Alt- in Vim takes focus to the menu bar if a menu with the hotkey 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 keys, (some European users need to use the key to enter diacritics), you can change these maps to other keys as described in the section Customizing Alt-key maps [|ls_a_cx|]. *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{<++>}<++>. *ls_3_10_2* *ls_a_bC* *Alt-B* This insert-mode mapping encloses the previous character in \mathbf{}. *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{} *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, has styles defined forthe following environments: Environment Style~ itemize \item enumerate \item theindex \item thebibliography \item[<+biblabel+>]{<+bibkey+>} <++> description \item[<+label+>] <++> 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 % will insert "\item[<+label+>] <++>" if % used here \end{description} \item third item % will insert "\item " when if used here. \end{itemize} % will insert nothing ("") if used here < The style used by 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 etc. To do this, you will need to specify the second argument in double-quotes as follows: > :call IMAP('EFE', "\\begin{figure}\<++>\\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', "\=MyFoonction()\", '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', "\=AskVimFunc()\", '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 = '' else let sidstr = '' endif return IMAP_PutTextWithMovement( \ "\" ".name.": <+short description+> \" . \ "Description: <+long description+>\" . \ "\function! ".name."(<+arguments+>)<++>\" . \ "<+function body+>\" . \ "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 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 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 > Options TeX-Suite > Packages > Commands where 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 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 [|ls_a_bh|] or [|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_ *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_ *ls_4_4_2* *ls_a_bQ* > g:TeX_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[<